Email or username:

Password:

Forgot your password?
Top-level
mhoye

@hyc @jrconlin

If you're telling people that the solution to navigating bad documentation is to learn regular expressions, then I don't even know what to say. That's like telling somebody who's struggling to climb a mountain that why don't you just learn how to fly?

Anyway, here's what you get when you use gcc to compile Hello World, with single quotes instead of double quotes. Not, please: those are warnings, not errors. The compile actually finishes and produces an executable.

6 comments
Howard Chu @ Symas

@mhoye I'm not sure what you're trying to illustrate with that example. You seem to be suggesting that compilers should be friendly enough to be usable by people who don't know the programming language. A C programmer has to know the difference between a character constant and a string literal, and what a multicharacter constant is. It's not the tool's job to teach the language syntax.

Anthony Sorace

@hyc @mhoye It’s not the tools’s job to teach the language, but that’s not what’s being asked for here. It *is* the tool’s job to provide meaningful errors, and it has failed here.

Howard Chu @ Symas

@a @mhoye The tool can't read the programmer's mind. Perhaps the "not a string literal" message should have been an error instead of a warning, since it clearly doesn't conform to the function signature. But beyond that, the programmer should know the difference between a string literal and any other data type. That's basic knowledge of the language. Knowing printf's signature is too, that's part of the language spec.

Matt Live in HD™

@hyc @a @mhoye it's warning about a multi-character character string, which means it basically does know that this is probably supposed to be double quotes. The programmers designed it to produce this warning here and for this reason, but then phrased the warning in a less coherent way

technomancy (turbonerd aspect)

@a @hyc @mhoye "treat the string as an argument to avoid this"

is gcc from mars??

Yancy Burns

@mhoye @hyc Then why does clang and llvm give better, more meaningful error messages than gcc?

Go Up