delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/01/14:26:33

Organization: FORTH - ICS, P.O.Box 1385, Heraklio, Crete, Greece 711 10
tel: +30(81)221171, 229368,02 fax: +30(81)229342,3 tlx: 262389 CCI
Date: Wed, 1 Jun 1994 20:35:40 +300 (EET)
From: Alkiviadis Pervenas <pervenas AT athena DOT compulink DOT forthnet DOT gr>
Subject: -funsigned-char -Wall and C++ compilation
To: djgpp listserver <djgpp AT sun DOT soe DOT clarkson DOT edu>
Sender: pervenas AT athena DOT compulink DOT forthnet DOT gr

Is there anyone that could explain to me, why the following piece of code
when compiled as C++ (options: -x c++ -Wall -funsigned-char)
generates the warning 'comparison between promoted unsigned and signed'
but when compiled as plain C (options: -Wall -f unsigned char) does not ?

If the declaration of x is changed to 'unsigned char x' in C++, why
there is no warning? What is the difference ?

How could avoid this warning without dropping -Wall ?

    char x = ..
    ......
    if (x)       <-- warning: comparison between promoted unsigned and signed
     ......


thanks in advance,
Alkis Pervenas
-----------------------------------------------------------------------------
Hofstadter's Law: It always takes longer than you expect, even when
                  you take into account Hofstadter's Law.
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019