This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: sizeof array-typed function parameter: Warning possible?


It is already filed as bug 6940.

Thanks,
Andrew Pinski

On Wednesday, Aug 13, 2003, at 12:35 US/Eastern, Claus Fischer wrote:


I just tripped over this: void f(char x[100]) { snprintf(x,sizeof(x),"foobar"); } I understand that section 6.7.5.3 #6 of my draft C standard means the compiler is right, as usual :-)

I guess it's not possible to devise a very clever GCC compiler
warning that detects such nasty programmer errors?

Of course   sizeof(x)  could really be meant in the way that
the standard prescribes for interpreting it, so I see little
chance. It would be VERY nice though.

Regards,

Claus

--
Claus Fischer <claus.fischer@clausfischer.com>
http://www.clausfischer.com/




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