public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jimsmite at rocketmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/43991]  New: typeof (size_t) inconsistency
Date: Wed, 05 May 2010 12:52:00 -0000	[thread overview]
Message-ID: <bug-43991-19132@http.gcc.gnu.org/bugzilla/> (raw)

size_t is declared as unsigned int on 32-bit and unsigned long on 64-bit.  As a
result, following code will emit a warning on amd-64:

  printf ("%u\n", sizeof (int));
  test.c:5: warning: format &#8216;%u&#8217; expects type &#8216;unsigned
int&#8217;, but argument 2 has type &#8216;long unsigned int&#8217;

but changing the format would then fail on ia-32:

  printf ("%lu\n", sizeof (int));
  test.c:5: warning: format &#8216;%lu&#8217; expects type &#8216;long unsigned
int&#8217;, but argument 2 has type &#8216;unsigned int&#8217;

there seems to be no way to satisfy this other than a cast, which seems a bit
awkward.  Is there any reason for size_t not being "unsigned long" consistently
on all platforms?


-- 
           Summary: typeof (size_t) inconsistency
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jimsmite at rocketmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43991


             reply	other threads:[~2010-05-05 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05 12:52 jimsmite at rocketmail dot com [this message]
2010-05-05 13:02 ` [Bug c/43991] " pluto at agmk dot net
2010-05-05 13:19 ` redi at gcc dot gnu dot org
2010-05-08 19:50 ` jimsmite at rocketmail dot com

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=bug-43991-19132@http.gcc.gnu.org/bugzilla/ \
    --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).