tech-userlevel archive

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

Re: printf and -m



> gcc assumes that %m is a valid printf(3) format.  [...]

I think this deserves a bug report; printf() has a real spec, and as
far as I can tell it contains no justification for %m.  If Linuces (and
any others with %m in printf) want it, let them maintain their own
private patches, as for any other nonstandardidity.

> We should decide what we want to do:

> - Make %m work in printf() like linux does.
> - Apply the following patch to prevent programs use %m in printf
>   formats, keep fixing 3rd party code, and maintain the custom format
>   attribute to find new offenders.

> What do you think?

I prefer the second one.  Indeed, I would go further and eliminate %m
even from syslog; I see no need for it in the presence of strerror() -
I believe it predates strerror, and I think %m should have been removed
from syslog when strerror arose.

Of course, my opinion is worth approximately what you paid for it.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index