Re: {Spam?} Re: implicit cast from unsigned long to unsigned int gives no warning with -Wall (64 bits arch)

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

 





On Wed, 21 Nov 2007, Tom St Denis wrote:

Vincent Torri wrote:

hey,

I have an ubuntu 64 bits on my core 2 duo. gcc version is 4.1.2

I compile that code with -Wall:



unsigned int htonl (unsigned int i)
{
  i = 0;
  return 0;
}

int
main ()
{
  unsigned long i;
  unsigned int j;

  i = 0;
  j = htonl (i);

I want to know why you assume j = ... should give a warning but not i = 0. (hint: what is the type of 0?).

forget the j, it's htonl(i) that matters here. It's the only location where there is a implicit cast from a 64 bits int (i) to a 32 bits int (the parameter of htonl), like the subject is telling you.

Vincent Torri

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux