delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/21/01:27:39

Message-Id: <199710210524.PAA06866@rabble.uow.edu.au>
Subject: gcc warning bug or just non-standard type?
To: djgpp AT delorie DOT com (DJGPP)
Date: Tue, 21 Oct 1997 15:24:22 +1000 (EST)
From: Brett Porter <bporter AT rabble DOT uow DOT edu DOT au>
MIME-Version: 1.0

Hi all

I compile with the options: -W -Wall -Werror and -Wformat

The one of interset here is -Wformat. The other day I typed this:

sprintf( str, "%D", i )

where str is a char* and i is a long int.

DJGPP says that "%D" is an invalid format specifier: yet the libc info docs
say it is a long integer... hmmm.. strange. So I just used %li instead,
which was fine. I was just curious why the other one supposedly is wron (I
didn't try to actually run it with that, so I don't know if it actually does
work once I turn off the Wformat option to compile correctly. Suppose I
shouldv'e done that.

Anyway, does anyone have a historical or other reason why there are so many
ambiguities in the printf options anyway? Like %d and %i. Or am I just
ignorant or some special feature of each?

Thought I'd let you know. If it is a GCC bug and not a DJGPP bug I will
report it to the relevant "authorities".

Thanks
Brett

-- 
"Who here believes in telekenesis? Raise MY hand!"
--
Brett Porter
bporter AT rabble DOT uow DOT edu DOT au

http://www.geocities.com/CollegePark/Union/3596
	Humour, Programming, and more.

- Raw text -


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