[ILUG] gcc and printf style functions
kevin lyda
kevin+dated+1110405085.510c82 at ie.suberic.net
Fri Mar 4 21:51:11 GMT 2005
On Fri, Mar 04, 2005 at 07:27:59PM +0100, Brian Foster wrote:
> tip: unless you are doing something sneaky elsewhere,
> it is a good idea to use __format__ and __printf__,
> i.e.: __attribute__((__format__(__printf__, 2, 6)))
> because those names are less likely to be #define'd
> by some idio^H^H^H^H^Hone else.
yes, good point. and gcc supports that.
> |[ ... ]
> | i've read through the gcc docs and as far as i can see, i'd need to
> | change gcc in order to support new % format codes. am i missing
> | something?
> I've always assumed --- but without research! --- that
> the % codes are hardwired into gcc. in addition to
> the answer to Kevin's question, I would be interested
> in knowing:
they're defined in c-format.c in the gcc sources it appears.
> - is it possible, without changing gcc, to remove
> or redefine some of the % codes it does know?
i think it should be. and i think the argument for it is that the
format escapes are actually handled by the target libc. gcc seems to
know glibc and various versions of ansi/iso c. but gcc targets platforms
with other libc's - the mingw gcc uses the ms libc.
> it's never been too important, but if someone just
> happens to know .... thanks.
yes, but it's a great way to catch some silly errors.
kevin
--
kevin lyda ~ dems for torture: salazar(co/10) landrieu(la/08) pryor(ar/08)
kevin at ie.suberic.net ~ nelson(fl/06) nelson(ne/06) lieberman(ct/06) 2/2/04
Those who refuse to raise their voices against something as clearly evil
as torture are enablers, if not collaborators. --Bob Herbert, 2/11/04
More information about the ILUG
mailing list