Current-Users archive

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

Re: isspace() behaviour



On Sun, Dec 15, 2024 at 08:34:35PM +0000, Patrick Welche wrote:
> Chasing a problem in print/pmw, I came across the following difference
> in behaviour:
> 
> #include <ctype.h>
> #include <stdio.h>
> 
> int main()
> {
>         printf("%d", isspace(0xffffffffu));
> 
>         return 0;
> }
> 
> causes a segmentation fault on NetBSD-current/amd64, but returns 0 on
> ubuntu 24. One could say "don't do that, 0xffffffffu isn't a valid char".
> (That value was used in the program as "an EOF occured when that char
> was read".)
> 
> Comments?

See ctype(3) Caveats section.


Home | Main Index | Thread Index | Old Index