delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/21/07:26:32

Date: Tue, 21 Oct 1997 13:24:55 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Brett Porter <bporter AT rabble DOT uow DOT edu DOT au>
cc: DJGPP <djgpp AT delorie DOT com>
Subject: Re: gcc warning bug or just non-standard type?
In-Reply-To: <199710210524.PAA06866@rabble.uow.edu.au>
Message-ID: <Pine.SUN.3.91.971021132014.3667N-100000@is>
MIME-Version: 1.0

On Tue, 21 Oct 1997, Brett Porter wrote:

> DJGPP says that "%D" is an invalid format specifier: yet the libc info docs
> say it is a long integer... hmmm.. strange.

Some format letters are standard (ANSI/ISO) C, others are extensions.
GCC doesn't know anything about the library, so it only knows about ANSI 
standard formats.  "%D" indeed is not ANSI.

> 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.

That's up to you.  But I would suggest to not use non-standard extensions 
where standard features exist with the same functionality.  My experience 
indicates that not only is this good for portability, but also standard 
features usually have much less bugs (because they are well-defined, and 
because test suites exist to test them).

- Raw text -


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