NetBSD-Users archive

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

toupper and warnings



We used to get warnings when toupper was called with char, because it is
UB pe POSIX if the value is negative.

I am not seeing this any more on NetBSD 9.

I wonder if this is intended, and if the UB is safely avoided somhow, or
if the warning is just missing, or ?

example program that I think should get a UB warning; doesn't on
netbsd-9.

----------------------------------------
#include <ctype.h>
#include <stdio.h>

int
main()
{
  char c, d;

  c = getchar();

  d = toupper(c);

  if (d != c)
    return 1;
  else
    return 0;
}

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index