This is the mail archive of the gcc-help@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: -Wall incorrectly complains about scanf with %a


On 26-mei-04, at 2:04, Eljay Love-Jensen wrote:
Hi Paul,

I agree with you that the compiler's complaint is incorrect.

"%a" isn't a valid format specifier.

But it is. It is equivalent to %e, %f, or %g.


Well, this is "new" in C99...  ("new" as a five year old
standard sure can't be called new anymore).

"%as" is a valid format specifier, and it takes an address of an uninitialized char pointer, which will be set to a malloc'd value sufficient to hold the character array.

Also note (http://www.rt.com/man/scanf.3.html), the "a" modifier is not part of ANSI C. It's a GNU libc extension.

So glibc needs to change, as %a is taken by ISO C now.



Good catch! File a bug.

Against glibc, please ;-)


[And maybe GCC should warn if operating in some compatibility mode].


Segher



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