delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/29/02:13:23

Date: 29 Jul 2003 08:33:31 +0200
Message-Id: <uoezd3kqs.fsf@elta.co.il>
From: Eli Zaretskii <eliz AT elta DOT co DOT il>
To: djgpp AT delorie DOT com
In-reply-to: <bg4dkh$8er$1@newsreader1.netway.at> (nospam@aol.com)
Subject: Re: integer overflow
References: <3F246120 DOT 63C3753C AT worldnet DOT att DOT net> <Z6_Ua.375$%S6 DOT 105 AT newsread1 DOT news DOT atl DOT earthlink DOT net> <3F24AA4B DOT 589D3482 AT worldnet DOT att DOT net> <bg3d1h$d30$1 AT newsreader1 DOT netway DOT at> <7458-Mon28Jul2003184701+0300-eliz AT elta DOT co DOT il> <bg4dkh$8er$1 AT newsreader1 DOT netway DOT at>
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

> From: "News Reader" <nospam AT aol DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Tue, 29 Jul 2003 02:00:54 +0200
> 
> Being human and therefore being prone to making mistakes
> from time to time, I will not allow any of my programs to run
> if the compiler output produces a single warning as a matter
> of principle.

That's fine, but it's not really an issue here, although it sounds
like you were mistaken to think it was (or else failed to make it
clear what did ``won't work'' mean).

> Compilation of your code produces the following output:
> 
>    x.c: In function `main':
>    x.c:7: warning: unknown conversion type character `U' in format
>    x.c:7: warning: too many arguments for format

Right, I also saw those messages under -Wall, and I expect to see
them, as GCC doesn't know about %U.

> Therefore %U won't work (for me). The same applies to
> %D and %O although even here program outputs appear
> to be correct.

You see, this is why it's important to explain what does it mean
``won't work'': your definition of that might be perfectly correct
and clear for you, but not for others, nor, as it happens to be, is
it correct objectively.  The program does work and produces the
correct results, while using -Wall is optional and is not required to
compile a valid program.  (In fact, some prominent programmers, such
as Richard Stallman, are opposed to using -Wall in principle, because
it sometimes flags perfectly valid code.  I do use -Wall as a matter
of routine, btw.)

> I am well aware of the differences between signed and unsigned,
> thanks, I was just cutting into this thread to get the %U mystery
> solved.

I hope it is solved now.  If not, please ask more questions.

> (Still wondering why %U was ever documented if it is non-standard
> and produces warnings?)

Because DJGPP wants to be compatible to old DOS compilers, like
Borland's one and the old MSC.

Note that your original message said ``why is %U documented if it
doesn't work'', which is quite a different story.  If your wording was
as above to begin with, it would have saved me quite some time that I
wasted to (1) look at the library sources in search of a possible bug,
(2) write a test program to see if %U really worked like the sources
seem to claim, and (3) post a message that explained in so many words
what I thought might be the source of your confusion.  Instead of all
that, I could simply tell you about the compatibility issue, and
that's all.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019