delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Received: | by 10.66.65.109 with SMTP id w13mr1177480pas.21.1392917244564; |
Thu, 20 Feb 2014 09:27:24 -0800 (PST) | |
X-Received: | by 10.50.142.66 with SMTP id ru2mr193387igb.9.1392917244013; Thu, |
20 Feb 2014 09:27:24 -0800 (PST) | |
Newsgroups: | comp.os.msdos.djgpp |
Date: | Thu, 20 Feb 2014 09:27:23 -0800 (PST) |
In-Reply-To: | <5305FF1A.4010804@Damon-Family.org> |
Complaints-To: | groups-abuse AT google DOT com |
Injection-Info: | glegroupsg2000goo.googlegroups.com; posting-host=118.168.202.186; |
posting-account=WqoaTgoAAABn_56zOqG1zk1m0UvtHqAO | |
NNTP-Posting-Host: | 118.168.202.186 |
References: | <61118811-548e-4c11-8d04-e73de3c7da86 AT googlegroups DOT com> <5305FF1A DOT 4010804 AT Damon-Family DOT org> |
User-Agent: | G2/1.0 |
MIME-Version: | 1.0 |
Message-ID: | <913a8783-5caf-441e-a502-12d2ac4d782f@googlegroups.com> |
Subject: | Re: DJGPP gcc 4.7.3 and 4.8.2 work inconsistently on type uint32_t. |
From: | Andrew Wu <andrewwu DOT tw AT gmail DOT com> |
Injection-Date: | Thu, 20 Feb 2014 17:27:24 +0000 |
X-Received-Bytes: | 2438 |
X-Received-Body-CRC: | 2085558268 |
Bytes: | 2693 |
Lines: | 42 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id s1KHj2Ws001452 |
Reply-To: | djgpp AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
Richard Damon於 2014年2月20日星期四UTC+8下午9時11分54秒寫道: > > The problem is that by the standard, %x requires a parameter of type > > (unsigned) int, and uint32_t may or may not be of that type. Printing a > > uint32_t with a %x format is really a BUG in the program (or at the very > > minimum, a dependance on unpromised implementation defined behavior, > > which is really just a polite name for bug. > > > > I will admit that it is a common error for people who grew up on 32 bit > > machines, as for them int has always been 32 bits, so things always just > > worked (even if performing technically undefined behavior if the > > implementation decided that uint32_t should be a unsigned long (which > > also is 32 bits on most 32 bit machines). > > > > If you want to print out a uint32_t, you should include <inttypes.h> and > > use the macro PRIx32as in > > > > printf("Hello %" PRIx32 " \n", x); > > > > -- > > Richard Damon Ok, I understood. I just wanted to make sure it is not a bug. :D
webmaster | delorie software privacy |
Copyright 2019 by DJ Delorie | Updated Jul 2019 |