public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/43991] New: typeof (size_t) inconsistency @ 2010-05-05 12:52 jimsmite at rocketmail dot com 2010-05-05 13:02 ` [Bug c/43991] " pluto at agmk dot net ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: jimsmite at rocketmail dot com @ 2010-05-05 12:52 UTC (permalink / raw) To: gcc-bugs 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 ‘%u’ expects type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ but changing the format would then fail on ia-32: printf ("%lu\n", sizeof (int)); test.c:5: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/43991] typeof (size_t) inconsistency 2010-05-05 12:52 [Bug c/43991] New: typeof (size_t) inconsistency jimsmite at rocketmail dot com @ 2010-05-05 13:02 ` 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 2 siblings, 0 replies; 4+ messages in thread From: pluto at agmk dot net @ 2010-05-05 13:02 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from pluto at agmk dot net 2010-05-05 13:01 ------- use %Zd formatter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43991 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/43991] typeof (size_t) inconsistency 2010-05-05 12:52 [Bug c/43991] New: typeof (size_t) inconsistency jimsmite at rocketmail dot com 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 2 siblings, 0 replies; 4+ messages in thread From: redi at gcc dot gnu dot org @ 2010-05-05 13:19 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from redi at gcc dot gnu dot org 2010-05-05 13:19 ------- %Zd is a GNUism and assumes a signed type (e.g. ssize_t), %zu is ISO C -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43991 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/43991] typeof (size_t) inconsistency 2010-05-05 12:52 [Bug c/43991] New: typeof (size_t) inconsistency jimsmite at rocketmail dot com 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 2 siblings, 0 replies; 4+ messages in thread From: jimsmite at rocketmail dot com @ 2010-05-08 19:50 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from jimsmite at rocketmail dot com 2010-05-08 19:50 ------- Thanks for the tip -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43991 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-08 19:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-05-05 12:52 [Bug c/43991] New: typeof (size_t) inconsistency jimsmite at rocketmail dot com 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
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).