linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Derek M Jones <derek@knosof.co.uk>
Cc: Andrew Pinski <Andrew_Pinski@PlayStation.Sony.Com>,
	linux-sparse@vger.kernel.org,
	Linux/PPC Development <linuxppc-dev@ozlabs.org>,
	Linus Torvalds <torvalds@osdl.org>,
	Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Subject: Re: cast truncates bits from constant value (8000000000000000 becomes 0)
Date: Fri, 1 Dec 2006 21:00:11 +0000	[thread overview]
Message-ID: <20061201210011.GE3078@ftp.linux.org.uk> (raw)
In-Reply-To: <4570954F.70302@knosof.co.uk>

On Fri, Dec 01, 2006 at 08:49:19PM +0000, Derek M Jones wrote:
> 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).

"C++ way of doing things" is hardly an endorsement.  _IF_ we are changing
the way enum works, might as well do it sanely and have the type of
enumeration constant same as that of expression initializing it (with
usual implicit initializers).  But yes, that explicitly changes semantics -
enum { A = 0L, B, C }; will have A, B and C long, not int.  Direct
contradiction with C90/C99...

  reply	other threads:[~2006-12-01 21:00 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
2006-12-01 20:49         ` Derek M Jones
2006-12-01 21:00           ` Al Viro [this message]
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=20061201210011.GE3078@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=Andrew_Pinski@PlayStation.Sony.Com \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=derek@knosof.co.uk \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=torvalds@osdl.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).