This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpplib: adjust column counter for tabs


On Thu, May 18, 2000 at 07:01:49AM +0900, Neil Booth wrote:
> Zack Weinberg wrote:-
> 
> > You should check that arg is not the empty string before calling
> > strtol (unless this is guaranteed by the option parser - I forget),
> > and you should check that endptr points to the end of string
> > afterward.
> 
> arg != 0 is guaranteed.  It could be a zero-length string though -
> strtol has no problem with that though, does it?  Yes, I forgot
> the *endptr == '\0' check.

strtol has no problem with a zero-length string, but the 
*endptr == '\0' check won't distinguish an empty string from a
legitimate number.  It will still get caught by the range check, since
strtol will return 0.  But the error message for -ftabstop= <nothing>
should say missing argument, not value out of range.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]