public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "lukew at radterm dot com dot au" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/27195] hex and oct constants are converted to wrong type
Date: Fri, 27 Oct 2006 03:51:00 -0000 [thread overview]
Message-ID: <20061027035110.1757.qmail@sourceware.org> (raw)
In-Reply-To: <bug-27195-7606@http.gcc.gnu.org/bugzilla/>
------- Comment #7 from lukew at radterm dot com dot au 2006-10-27 03:51 -------
(In reply to comment #6)
> Subject: Re: hex and oct constants are converted to wrong type
>
> lukew at radterm dot com dot au wrote:-
>
> > > The resulting tokens compose the controlling constant expression which
> > > is evaluated according to the rules of 6.6. For the purposes of this
> > > token conversion and evaluation, all signed integer types and all
> > > unsigned integer types act as if they have the same representation as,
> > > respectively, the types intmax_t and uintmax_t defined in the header
> > > <stdint.h>.142)
> > >
> > > 142) Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is
> > > 0xFFFF, the constant 0x8000 is signed and positive within a #if
> > > expression even though it would be unsigned in translation phase 7.
> > >
> >
> > I don't get it.
> >
> > How can 0x8000 be signed AND positive when INT_MAX is a 16 bit integer?
>
> Ask yourself what its type is.
>
intmax_t and INTMAX_MAX is 0x7FFFFFFFFFFFFFFF.
0x8000000000000000 is unsigned
where as (INTMAX_MAX + 1) is signed and negative.
Which is fine.
Thanks Neil.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27195
prev parent reply other threads:[~2006-10-27 3:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-18 8:15 [Bug preprocessor/27195] New: " mhx-perl at gmx dot net
2006-04-18 8:17 ` [Bug preprocessor/27195] " mhx-perl at gmx dot net
2006-04-18 8:21 ` rguenth at gcc dot gnu dot org
2006-04-18 11:22 ` joseph at codesourcery dot com
2006-04-18 13:26 ` mhx-perl at gmx dot net
2006-10-26 6:45 ` lukew at radterm dot com dot au
2006-10-26 12:42 ` neil at daikokuya dot co dot uk
2006-10-27 3:51 ` lukew at radterm dot com dot au [this message]
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=20061027035110.1757.qmail@sourceware.org \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).