I’m : a programmer, writer, podcaster, geek, and coffee enthusiast.

Am I the only one geeky enough to be annoyed by the syntax and bad style of this Axe ad that everyone’s reblogging?

Also, proper K&R style is “if” SPACE (condition) SPACE open-brace. The use of the “this” keyword as a member variable name rules out the possibility of this being valid C++, Java, or Javascript, while PHP doesn’t use the dot operator for member dereferencing (because it’s the string concatenator). Unless I’m forgetting about a major language using C-style syntax, the only language this could possibly be legal in is C.

Because it’s been 16 months since I’ve programmed in C, I was a little rusty, so I whipped up the test program above to make sure it’s valid. (It is.) I wasn’t sure if the “get.a.girlfriend” part, evaluating to a variable and not a function call, was valid. (It is, but it has no effect. “2;” is a valid C statement that does nothing. I assumed this would at least throw a warning in GCC… nope.)

I’ll ignore the syntax highlighting of the word “this” and assume that, rather than writing invalid code, they were just viewing C code in a C++ editor (from the font and style, probably MS Visual C++). In that case, they’re just guilty of bad style.

Sorry ladies, I’m taken.