Skip to content

Comment on Hacking ls -lparent

Comments

The printf ' format specifier is not Standard C. It's in neither the C99 Standard nor the new C11 Standard. So it's not actually valid, and it's a coincidence if it happens to work with your Standard Library.

Consider that the compiler generating that warning knows only Standard C, and in fact you could be pairing it with any C library, including those that are strictly conforming and don't support the ' extension.

You're arguing that the GNU C Library is incompatible with the GNU Compiler Collection?

(In the example, he's compiling ls with the -std=gnu99 flag, which means he's targeting GNU, not C99 or C90 or C11 or POSIX or any other standard.)

The printf(3) manpage now says: "Note that many versions of gcc(1) cannot parse this option and will issue a warning."

FWIW, GCC 4.7.2 parses the format string without warnings.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.