Changeset 99525be for owl.h

Timestamp:
Oct 20, 2009, 1:29:02 AM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.10, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
3c428d4
Parents:
6337cb5
git-author:
Anders Kaseorg <andersk@mit.edu> (10/19/09 23:29:35)
git-committer:
Anders Kaseorg <andersk@mit.edu> (10/20/09 01:29:02)
Message:
Use strtol without casting, to shut up gcc -Wcast-qual.

strtol should really have been two functions with types

  long int strtol(char *nptr, char **endptr, int base);
  long int strtol(const char *nptr, const char **endptr, int base);

but C doesn’t have overloading, so the real strtol has make a small
type safety compromise:

  long int strtol(const char *nptr, char **endptr, int base);

Such a compromise would be invisible in the return type (as it is with
char *strchr(const char *s, int c)), because char * may be implicitly
casted back to const char *.  But here char **endptr is an output
pointer argument, and we can’t pass it the address of a const char *.

Initially I rejected that compromise by casting endptr from the
address of a const char *.  But that makes gcc -Wcast-qual emit an
unnecessary warning, so let’s just use a char * instead.

</rant>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
(No files)

Note: See TracChangeset for help on using the changeset viewer.