From: Linus Torvalds <torvalds@osdl.org>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
Linux/PPC Development <linuxppc-dev@ozlabs.org>,
linux-sparse@vger.kernel.org,
Andrew Pinski <Andrew_Pinski@PlayStation.Sony.Com>
Subject: Re: cast truncates bits from constant value (8000000000000000 becomes 0)
Date: Fri, 1 Dec 2006 12:20:53 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612011215110.3695@woody.osdl.org> (raw)
In-Reply-To: <45705D79.6000107@am.sony.com>
On Fri, 1 Dec 2006, Geoff Levand wrote:
>
> 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).
But at times, some of the gcc extensions aren't necessarily that well
defined or thought out, or simply not worth it. The extended type system
for enums in gcc is just basically messy, and it doesn't really offer you
anything important.
Compared with inline assembly, for example, inline assembly may be even
messier and more complicated, but inline assembly definitely offers you
something very important. The strange enum type extensions? What do they
really offer above and beyond the standard C preprocessor #define's? Apart
from some (very limited) name scoping advantages, there really isn't
anything that it really helps with.
And as Al already mentioned, some of the extensions aren't even compatible
within different versions of gcc itself. Admittedly they are all fairly
special, but basically the "type" of different individual enum members
simply isn't well-defined in all cases, and will even depend on thigns
like the order they were declared in, if I recall correctly.
Messy, messy.
Linus
next prev parent reply other threads:[~2006-12-01 20:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 4:20 [PATCH 8/14] powerpc: add ps3 platform repository support Geoff Levand
2006-12-01 14:25 ` cast truncates bits from constant value (8000000000000000 becomes 0) Geert Uytterhoeven
2006-12-01 14:39 ` Al Viro
2006-12-01 14:55 ` Geert Uytterhoeven
2006-12-02 7:50 ` Michael Ellerman
2006-12-01 15:30 ` Linus Torvalds
2006-12-01 16:51 ` Geoff Levand
2006-12-01 20:20 ` Linus Torvalds [this message]
2006-12-01 20:49 ` Derek M Jones
2006-12-01 21:00 ` Al Viro
2006-12-01 21:19 ` Linus Torvalds
2006-12-01 20:50 ` Linus Torvalds
2006-12-01 21:17 ` Geoff Levand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0612011215110.3695@woody.osdl.org \
--to=torvalds@osdl.org \
--cc=Andrew_Pinski@PlayStation.Sony.Com \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=geoffrey.levand@am.sony.com \
--cc=linux-sparse@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).