This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: No printf-format checking for snprintf & friends?
- From: Martin Buck <martin dot buck at ascom dot ch>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 02 May 2002 11:23:39 +0200
- Subject: Re: [ECOS] No printf-format checking for snprintf & friends?
- Newsgroups: local.ecos.discuss
- Organization: Ascom Systec AG
- References: <3CC5194B.5A73B85B@ascom.ch> <3CCEF1F8.D5524726@redhat.com>
Jonathan Larmour wrote:
> I believed that GCC automatically does it for functions called printf()
> etc. I thought it was only non-standard functions that don't get the
> checking. Or are you saying that GCC doesn't do this for snprintf() in
> particular?
It's not done for snprintf() since snprintf() is non-standard as far as
ISO C90 is concerned. snprintf() exists in ISO C99, but gcc 3.0.4 only
checks it if you use -std=c99. The same is true for vsnprintf().
fnprintf() and vfnprintf() are non-standard both in ISO C90 and 99, so
they're never checked. I guess the non-standard *scanf() functions are
treated similarly.
> If you do add this, use a macro (and define it in cyg_type.h) for it.
OK, will do so.
Martin
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss