Re: cast truncates bits from constant value (8000000000000000 becomes 0)

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

 



Linus,

One of the gcc maintainers (Andrew Pinski) told me to set it up that
way, so I figured it was safe.

It _is_ safe, as long as you stick to gcc, and as long as you don't mix signs in your values, for example.

But we actually want to let people compile even the kernel with other compilers than gcc. Most of the time, that means that we strongly encourage those compiler people to support all the gcc extensions (let's face it, standardization is good, and open standards work better than closed ones, and gcc is the most widely spread open and portable compiler BY FAR, so it would be stupid to _not_ do that).

The C++ Standard explicitly supports enumeration constants not
having type int.  See sentence 858 of
http://www.coding-guidelines.com/cbook/cbook1_0b.pdf
for a discussion of the issues (plus some other sentences).

C compiler vendors, at least those who extend the language, are more
likely to want to follow the C++ rules (which are documented) than the
gcc rules (which are poorly documented).

The C++ way of doing things is also likely to be followed by vendors
whose C compiler is enabled by a command line switch on their C++
compiler (eg, at least one vendor based in Seattle).

--
Derek M. Jones                              tel: +44 (0) 1252 520 667
Knowledge Software Ltd                      mailto:derek@xxxxxxxxxxxx
Applications Standards Conformance Testing    http://www.knosof.co.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux