]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Add comments re ctype IS* macros.
authorJim Meyering <jim@meyering.net>
Sat, 7 Sep 1996 17:50:05 +0000 (17:50 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 7 Sep 1996 17:50:05 +0000 (17:50 +0000)
src/system.h

index 19df3d46fc74cea94cb9a3e39a499c58288ed3e6..873bf78ad1165a85207043c8a9e4ec62d184aef6 100644 (file)
@@ -300,6 +300,25 @@ char *alloca ();
 
 #include <ctype.h>
 
+/* Jim Meyering writes:
+
+   "... Some ctype macros are valid only for character codes that
+   isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
+   using /bin/cc or gcc but without giving an ansi option).  So, all
+   ctype uses should be through macros like ISPRINT...  If
+   STDC_HEADERS is defined, then autoconf has verified that the ctype
+   macros don't need to be guarded with references to isascii. ...
+   Defining isascii to 1 should let any compiler worth its salt
+   eliminate the && through constant folding."
+
+   Bruno Haible adds:
+
+   "... Furthermore, isupper(c) etc. have an undefined result if c is
+   outside the range -1 <= c <= 255. One is tempted to write isupper(c)
+   with c being of type `char', but this is wrong if c is an 8-bit
+   character >= 128 which gets sign-extended to a negative value.
+   The macro ISUPPER protects against this as well."  */
+
 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
 #define IN_CTYPE_DOMAIN(c) 1
 #else