This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: No printf-format checking for snprintf & friends?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]