Add a comment.
authorBruno Haible <bruno@clisp.org>
Fri, 3 Oct 2008 12:04:31 +0000 (14:04 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 3 Oct 2008 12:04:31 +0000 (14:04 +0200)
ChangeLog
lib/c-ctype.h

index 2a2ac3f8b083737d6faa306016d4ad20406e7223..3967763d58233cd90bd9e045b348523d049d84be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-03  Bruno Haible  <bruno@clisp.org>
+
+       * lib/c-ctype.h: Add comment.
+       Reported by Jim Meyering.
+
 2008-10-02  Bruno Haible  <bruno@clisp.org>
 
        * modules/posix_spawn-internal (Depends-on): Add 'open'.
index b26eccfb3d1df818013f7b62562cc20a393f9798..f3f9ab9d46f42ef31dafee48da9aa094eacf62e5 100644 (file)
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -103,6 +103,21 @@ extern "C" {
 
 /* Function declarations. */
 
+/* Unlike the functions in <ctype.h>, which require an argument in the range
+   of the 'unsigned char' type, the functions here operate on values that are
+   in the 'unsigned char' range or in the 'char' range.  In other words,
+   when you have a 'char' value, you need to cast it before using it as
+   argument to a <ctype.h> function:
+
+         const char *s = ...;
+         if (isalpha ((unsigned char) *s)) ...
+
+   but you don't need to cast it for the functions defined in this file:
+
+         const char *s = ...;
+         if (c_isalpha (*s)) ...
+ */
+
 extern bool c_isascii (int c); /* not locale dependent */
 
 extern bool c_isalnum (int c);