gcc-2.7.2.1

Matthias Andree matthias.andree at gmx.de
Wed Jan 21 17:02:18 CET 2004


On Wed, 21 Jan 2004, Stefan Bellon wrote:

> Does this piece of code compile in GCC's strict C90 or C99 mode?
> 
>         void f(char c, signed char sc, unsigned char uc)
>         {
>           char* pc = &uc;
>           signed char* psc = pc;
>           unsigned char* puc = pc;
>           psc = puc;
>         }

Steenkin' munchin' types!

It does, with a bag of warnings.

gcc 3.3.1 with SuSE breakage (doesn't matter if I tell it use C89 or
C99) and German locale (we see it's not completely translated):

try.c: In function `f':
try.c:3: Warnung: pointer targets in initialization differ in signedness
try.c:4: Warnung: pointer targets in initialization differ in signedness
try.c:5: Warnung: pointer targets in initialization differ in signedness
try.c:6: Warnung: pointer targets in assignment differ in signedness

Using -W -Wall also enables these:

try.c:1: Warnung: unused parameter `c'
try.c:1: Warnung: unused parameter `sc'

Sun Workshop Pro warnings, in comparison:

"tmp/try.c", line 3: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
"tmp/try.c", line 4: warning: assignment type mismatch:
        pointer to signed char "=" pointer to char
"tmp/try.c", line 5: warning: assignment type mismatch:
        pointer to unsigned char "=" pointer to char
"tmp/try.c", line 6: warning: assignment type mismatch:
        pointer to signed char "=" pointer to unsigned char

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95




More information about the Bogofilter mailing list