tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: printf and -m



In article <20150825203649.847dbf11.jklowden%schemamania.org@localhost>,
James K. Lowden <tech-userlevel%netbsd.org@localhost> wrote:
>On Tue, 25 Aug 2015 11:20:59 -0400 (EDT)
>Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
>
>> Perhaps jkl would also argue that the C standard is equally irrelevant
>> here, but I think that argument has to be made, not silently assumed.
>
>Thanks for pointing that out, Mouse.  Section 7.19.6.1,
>paragraph 9 says, "If a conversion specification is invalid, the
>behavior is undefined."  The patch just changes what form "undefined"
>takes in the case of %m.  
>
>> In particular, this patch also makes it easier to write nonportable
>> code and harder to catch it, because it will let %m slip through,
>
>IMO this is better diagnosed by the compiler with something like 
>gcc's -ansi option.  As it happens, -ansi does *not* (in my testing)
>produce a warning when %m is present.  I think they might consider that
>a bug. I'm willing to file a PR for that with them.  

I think that it is a valid bug. Let's see what they think :-)

christos



Home | Main Index | Thread Index | Old Index