standards/129196: Inconsistent errno in strtol()

Jilles Tjoelker jilles at stack.nl
Wed Aug 12 18:50:08 UTC 2009


The following reply was made to PR standards/129196; it has been noted by GNATS.

From: Jilles Tjoelker <jilles at stack.nl>
To: bug-followup at FreeBSD.org, shurd at sasktel.net
Cc:  
Subject: Re: standards/129196: Inconsistent errno in strtol()
Date: Wed, 12 Aug 2009 20:45:25 +0200

 The behaviour seems fine to me.
 
 POSIX.1-2008 on
 http://www.opengroup.org/onlinepubs/9699919799/functions/strtol.html
 allows errno=EINVAL if no conversion could be performed (but the proper
 way to check this is via endptr).
 
 Common sense suggests that strtol("0", NULL, 0) be successful and return
 0, and in fact that is the case ("0" is an octal constant).
 
 "0x" should be interpreted as a subject sequence "0" followed by
 unrecognized sequence "x".
 
 -- 
 Jilles Tjoelker


More information about the freebsd-standards mailing list