Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: isspace() behaviour



    Date:        Wed, 18 Dec 2024 19:45:36 +0100
    From:        Roland Illig <roland.illig%gmx.de@localhost>
    Message-ID:  <c9cd653a-3ece-4cdb-a5dc-7e380db1f942%gmx.de@localhost>

  | > You need to first test for EOF but then cast any non-EOF characters to
  | > unsigned char to be portable:
  |
  | That's wrong. The CAVEATS section explicit allows character I/O operations:


Yes, passing EOF (as an int) to these macros/functions is permitted, there
is no need to test for it as Martin's sample code did.

The problem case is when the return from [f]getc() is stored into a
char type variable, and then that variable is passed to the <ctype.h>
macros/functions - that doesn't work.   As long as only int variables
are used, it is all OK.

kre



Home | Main Index | Thread Index | Old Index