This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: too many warnings


The warning is correct, your code is incorrect; you failed to
indicate, that the numeric literal is 'unsigned' by appending
a 'U'. If you were using 

int
main (int argc, char **argv)
{
  unsigned a;

  a=4294967295U;	// Note the 'U' here!
}

everything compiles flawlessly without a warning!

manfred


On Thu, 29 October 1998, 10:27:01, demuynck@ruca.ua.ac.be wrote:

 > 
 > Hi,
 > 
 > I'd like you to try and compile the next bit of code using g++:
 > 
 > ----------------------------------
 > int
 > main (int argc, char **argv)
 > {
 >   unsigned a;
 > 
 >   a=4294967295;
 > }
 > -----------------------------------
 > 
 > You will get the following warning:
 > 
 > -------------------------------------------------------------------
 > bug.cpp: In function `int main(int, char **)':
 > bug.cpp:6: warning: decimal integer constant is so large that it is
 > unsigned
 > -------------------------------------------------------------------
 > 
 > I'm sorry but I don't think that a warning should be issued in this case.
 > Could this be resolved in one of the next versions?
 > 
 > If you think that the warning should stay, please write me at:
 > 
 > demuynck@ruca.ua.ac.be
 > 
 > Kris Demuynck.
 > 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]