Programming Language vs. Written Language

By Shamus Posted Thursday Mar 15, 2012

Filed under: Rants 227 comments

Rick recently asked:

Off topic here Shamus, but I'm curious. As a programmer and a writer does it bug you that writing convention has close quotes after the period at the end of a sentence?

Vader explained “Luke, I am your father.”

As a programmer it infuriates me that the quote reaches out past the end of the sentence. It's within the sentence, therefore logic dictates it should finish within the sentence.

I've even seen plenty of books/magazines/websites/newspapers miss the closing quote marks completely when at the end of a paragraph. For it to be that widespread it must be a typographical rule I'm unfamiliar with.

I’m sure a lot of this weirdness comes from the way the written word has evolved. First as pen-on-paper, then typeset, and finally to this digital form. However, that doesn’t excuse the lapses of logic in the system.

One of the problems here is that we’re nesting sentences.

Vader explained to Luke that he was his father.

That’s a complete sentence. So is this:

Luke, I am your father.

Both of them should get a full stop. My programmer logic says it should be like this:

Vader explained “Luke, I am your father.”.

So we have two full stops, one for the thing being said and another for the sentence relating who said it. Now, you could argue that the dot-quote-dot at the end just looks strange, and so leaving out a dot is a stylistic shorthand. This could be similar to the way the expression b=b+1 can also be expressed as b++, simply because this is such a common thing to do. However, shorthands should be offered in addition to the long-form correct way, and dot-quote-dot is not correct according to the accepted rules.

This becomes a problem when the ending punctuation of the quoted sentence doesn’t match the containing sentence. For example, some people like to say:

Not bad for a Monday!

Let’s say this gets on my nerves, and I want to ask if you feel the same way. Apparently the grammatically correct way to do this is:

Don’t you hate when people say “Not bad for a Monday”?

But this obliterates the exclamation in the original quote. I think this is a much better way to do it:

Don’t you hate when people say “Not bad for a Monday!”?

Unfortunately, this is wrong, and will get red-penned by any self-respecting instructor or editor.

Yes, it looks odd, but I suspect that’s only because this is unfamiliar to us. At least this system makes sense and follows rules that can be intuited. The rules on using quotes in written prose are dauntingly complex and filled with odd exceptions.

However, the written word is not the only place we find annoying exceptions. The for loop in C++ has always annoyed me. In C++, we are taught that ALL STATEMENTS MUST END WITH A SEMICOLON. Except for this one spot in the humble for loop:

for ( x=0; x<3; x++) 
  cout < < "The value of X is:" << x << endl;

The for loop begins with three expressions inside of the parenthesis. The first is executed once, when the loop begins. Then the second is evaluated, and the loop will repeat until this expression evaluates to false. The third is performed every time the program reaches the end of the loop. But there's no semicolon after that third expression.

In defense of C++, I think you can throw a semicolon in there like this:

for ( x=0; x<3; x++;) 
  cout < < "The value of X is:" << x << endl;

I'm pretty sure the compiler won't complain. However, your fellow coders will. A lot. So don't do this unless you want to end up getting shivved in the break room. (I can't test this because I haven't installed a compiler since re-installing my OS. I didn't realize this until just now. I think this is the longest I've been without a compiler since 1994 or so.)


From The Archives:

227 thoughts on “Programming Language vs. Written Language

  1. Trevel says:

    Regarding quotation marks at the end of paragraphs — if the SAME speaker is continuing in the next paragraph, you don’t put the closing quotation mark at the end of it, as you would if someone else was replying to him.


    Joe said, “Blah blah blah.

    “Yadda Yadda,” he concluded.

    1. MichaelG says:

      “Is he serious?”, I wondered. That’s legal, right?

      “He is serious.”, I think. That’s not, right?

      1. Alan says:

        As best I know, punctuation is always inside of a closing quote, never outside. So the correct versions of both are:

        “Is he serious,” I wondered.

        “He is serious,” I think.

        You lose the question mark, which is arguably a loss of information, but no one ever said english made a lot of sense.

        1. krellen says:

          Actually, I think sometimes a comma is not necessary:

          “Why so serious?” I asked.

          1. Alan says:

            Derp! You are absolutely right! I completely brain farted there.

            This thread as a whole convinced me to to a very small amount of research, and it looks like what I’m used to is American-specific; British punctuation has slightly different rules. It’s a wonder we can communicate at all! :-)

            1. Soylent Dave says:

              We are two countries divided by a common language

              “(and a fucking great big ocean, thank Christ)” – Al Murray

        2. MichaelG says:

          Hmm.. You made me look it up. According to this:

          Rule 5

          Use quotation marks to set off a direct quotation only.

          “When will you be here?” he asked.

          Nothing about periods inside quoted sentences.

          1. Methermeneus says:

            Periods go inside quoted sentences only if the quote ends the sentence and would end with a period were it not a quote:
            He said, “Frankly, my dear, I don’t give a damn.”

            If a sentence that would end in a period is being quoted and does not end the sentence, replace the period with a comma:
            “Frankly, my dear, I don’t give a damn,” he said.

            If the quoted sentence ends with a question mark or exclamation point, retain that punctuation regardless of position within the quote:
            “Why did he say that?” I asked.
            You reply, “He’s a total jerk!”

            As Shamus pointed out, the tone of the most immediate speaker overrides the tone of the quote if it requires an exclamation point or question mark:
            Did you just say, “I prefer Ashley?”
            I did just say, “I prefer Ashley!”

            Contrast this with the second sentence in the previous example, where the exclamation point of the quote overrides the period of the dependent clause. Also, if both sentences have special punctuation, an order of operations ensues in which ? > ! > : > ; > . > — > … > – (someone may be able to correct me on the order).

            Also, as demonstrated above, any time a quote intersects the rest of a sentence and does not have another type of punctuation to override, the quote is further separated by a comma before each quotation mark. This can occur even when a quote is split in places where there would not otherwise be punctuation:
            “So, when,” I asked, “did Scarlett give Rhett any reason to care?”

            As pointed out by Trevel, quotation marks at the end of a paragraph should be omitted if the following paragraph continues the quote with no interruption. However, quotation marks at the beginning of a paragraph can never be omitted.

            I’m not entirely certain about colons and semicolons (both of which are used at the end of independent clauses, just like all the rest except for commas). I think they follow the same rules as exclamation points and question marks, but I’m always afraid to look it up because that looks horribly wrong to me. Hyphens, ellipses, and dashes also go to the left of all quotation marks; however, parentheses follow order of operations like any math or computer geek would expect.

            I have no idea why I wound up using Gone with the Wind examples, but whatever. This pedantic foray brought to you by my attempts to procrastinate from going back to trying to force buggy javaScript to work.

            1. Halceon says:

              Pretty much this. Semicolons never end a sentence, so the only point where they can be before a quote mark is in a divided speech sentence. “This is horrible;” Eris frowned, “they’re getting along and not squabbling!”

    2. Mephane says:

      Okay now I am seriously confused. In German, the rule is to write the comma like this:

      “Hello there”, dad said, “how are you?”

      This rule is being hammered into schoolchildren so much that I couldn’t even think that English might have the comma place differently, but you suggest in English it should be

      “Hello there,” dad said, “how are you?”

      So may I assume that in the English language, the first is wrong and the second is right?

      1. Alan says:

        The second one is correct in American english, yes.

        1. Mephane says:

          Well then remains the question whether the first version is also wrong?

          The reason why I ask is that I have always used the first one, somehow assuming that this rule would apply to English just as well. But if it is wrong… OHGODWHATHAVEIDONE?


          1. Soylent Dave says:

            Yes, the first one is wrong.

            And that’s in British English (or ‘English’ as we like to call it over here) as well as Yanklish (this doesn’t seem to have caught on as a name for the dialect, which is a shame).

            It’s particularly odd when you know that English is primarily a Germanic language – perhaps it’s the French influence (I know sod all about French grammar, so I don’t know). The posh bits of English are usually French, while the common bits of English are usually Saxon – but grammar is a bit of a tangle.

            1. krellen says:

              As a Yank, I’m actually fond of the name Yanklish. I might have to try that.

            2. Blake says:

              Actually everything I’ve ever read has the first one correct in British non-fiction and it’s how I’ve always done it down here in Australia:

              1. Soylent Dave says:


                It’s an Oxford and Cambridge thing, then – Oxford University Press (and therefore Fowler’s style guide) enforce a few slight grammatical differences to the rest of the English language.

                It’s growing a bit more noticeable as time marches on, but it’s always interesting to find one (the Oxford comma is the most well known, of course)

                Edit: and – just hit me – that would also be why the non-fiction you’ve read is much more likely to adhere to Fowler’s; non-fiction is always more likely to adhere to Oxford rules, fiction is more likely to adhere to Cambridge rules.

                (don’t ask me why, I only live here)

            3. Zak McKracken says:

              I think the posh bits of English are mostly Latin, it’s just that the Romans got to France first, and stayed there a lot longer than in Britain. That’s why
              French consists almost entirely of Latin, except for the numbers above 60 which are still Gaulish. So English, consists of whatever people were speaking in Britannia before the Celts landed on the island, of Celtic, Latin and the proto-German that the Angles and Saxons brought with them. And since for a long time the Romans were pretty posh, and Germans weren’t, that’s where the posh words came from.
              And then it was all spun around, shaken, stirred and randomized for a few centuries. Since then there’s almost no European language that doesn’t contain at least a bit of every other European language. Makes it a lot easier to learn them all. Except if you’re English and never learned to use proper grammar :)

              You can still trace the Angles and Saxons, linguistically, by going from central Germany to the German north sea cost and hear people talk “platt”, the local dialect, then to the Netherlands. If you extrapolate from there for a bit you arrive pretty close to actual English, except Dutch is just so much more fun to listen to than English. I think the Dutch accent is to “high” German about as the Scottish accent is to “English” English. It just makes me smile :)

              1. The history of English is pretty interesting. Start with Celtic, remove most of it, throw in a bit of Latin, add large quantities of proto-Germanic from the Anglo-Saxons, combine with Norman French (since after William the Conquerer the elite spoke French and the commoners spoke Saxon), and stir for a bit.

                1. Adam F says:

                  Then overlay a bunch of Latin and Greek based technical terms, and random bits from elsewhere.

                  1. MichaelG says:

                    Yes, it’s cultural mixing run amok.

                  2. MrPyro says:

                    And then run all over the world annexing words from other people’s languages.

                2. Chargone says:

                  … ok, latin and celtic contribute basically nothing but place names to the base structure of english.

                  then you get anglo-saxon, then Lots of Danish/norse, and some norman french.

                  from memory, at this point, it’s still mostly saxon/danish.

                  THEN you get a whole lot of words come in later on as english goes through it’s own shifts and starts interacting with the rest of the world. most of the obvious latin/french (and complete fabrications), and as a consequence dictionaries, start showing up As Part Of English, rather than a separate language, around the time of shakespere or so.

                  Then you get the modern spellings… which are mostly the fault of dutch printers.

                  THEN you get ‘the great vowel shift’ which completely buggers those up beyond all usefulness.

                  Then you get the influx of random words looted from all over the place due to the British Empire (and perscriptivist grammar based on absolutely crap all trying to force people to speak english as if it were latin despite that being blatantly wrong, but it still twists some spellings and things further.)

                  but yeah, celtic provided almost nothing to english, certainly not directly. Latin only provided placenames from the time when it was actually spoken in england, the rest of it is picked up later when the educated classes needed words for new stuff, norman-french contributed little overall, save perhaps words for stuff which wasn’t around prior to that and, again, place names, the French words in english mostly showing up later due to french being the language of diplomacy and the noble classes throughout europe later on.

                  at least, that’s what i remember of it.

                  1. That’s what I remember. But I learned my history of English from one book, so I am quite willing to admit my source was biased.

              2. Soylent Dave says:

                It was really after the Norman conquest that French and Latin were the languages of the nobility, and Saxon being the language of the poor.

                This can be felt today mostly in our words for things like food – the word for the animal is normally Germanic, and the word for the food is normally French (it’s the poor does the farming and it’s the rich what eats it)

                e.g. Cow / Beef; Swine / Pork; Deer; Venison

                1. Methermeneus says:

                  There’s also an amusing little line in Ivanhoe where peasants complain about this juxtaposition. It’s been a while since I read it, but I seem to recall they were wondering why a live pig is swine, but a dead one is pork.

            4. I suspect that my bit of the USA would start screaming loudly if Yanklish caught on. But then again, I grew up calling our Civil War ‘the War of Northern Aggression’ or ‘that recent unpleasantness’, so I may be a bit too Southern for my own good. How about ‘the President’s English’ to go along with ‘the Queen’s English’?

              1. Darkness says:

                The more southern one is the easier it is to understand complicated family trees. Fred is my second cousin twice removed on my mother’s side. Which I don’t understand at all, although I have had that explained to me a time or two.

                Plus, you have mint juleps.

                1. MrPyro says:

                  Your second cousin is the child of your parent’s cousin. If you had a child and so did your second cousin, they would be third cousins. And so on.

                  The “twice removed” thing refers to a generational gap; if you are stating a relationship to a distant relative who is of a different generation to you, you state the relationship between your direct ancestor of the same generation as the person in question, and then X times removed, where X is the number of generations between you and the direct ancestor.

                  So your grandmother’s cousin would be your cousin twice removed; cousin because that is the relationship between the person and your direct ancestor (grandmother), and twice removed because there is a two generation gap between you and your grandmother.

                  I hate that explanation because I can understand it, but it looks like a giant mess of words.

              2. Newbie says:

                I’m pretty sure the Queen is a more solid form of head of state. The President changes every so often.

                Although the President I guess isn’t a head of state, because you have states within your state. Are you sure USA isn’t just an alliance?

                1. Xavin says:

                  My understanding* is that the “recent unpleasantness” that Melfina refers to above is the point where people stopped using the phrase “The United States are…” and replaced it with “The United States is…”

                  *: as an observer from the other side of the Atlantic – so anyone who is better informed should feel free to correct me.

                2. Soylent Dave says:

                  The Queen changes every so often as well.

                  For example, in the not too distant future, given that she is quite an old lady, she’ll change into a King.

              3. Soylent Dave says:

                Yankee originally just meant ‘American’ though.

                It’s only that America stubbornly kept on growing which meant the word (for you lot) shifted its meaning – i.e. you assume it just referred to the original colonies, we assume it just means ‘American’.

                I also like ‘Colonial English’ as a term.

                (worth pointing out that this point that American pronunciations – especially in New England – are actually a lot closer to 17th and 18th century British pronunciation than any of our dialects are. Bit odd to think that the ‘American accent’ is rather more like what we used to sound like…)

              4. krellen says:

                I was waiting for one of you Southerners to object. As a Yank, I couldn’t do it on your behalf.

                1. decius says:

                  We have no reason to object. We speak our own language, anyway.

  2. Cat Skyfire says:

    You forgot to throw in the fun of parentheses. The final punctuation goes on the outside of the last one. “No, I am your father,” he said (for he was Luke’s father).

    1. Dave B says:

      That example actually makes a bit of sense, as the period marks the end of the entire sentence, not just the bit inside the parentheses. Maybe someone can tell me if this example would be correct:

      “No, I am your father,” he said. (He was indeed Luke’s father.)

      1. droid says:

        According to Strunk and White, the inline parenthetical form (like this) has no full stop.

        (A completely detached sentence in parenthesis does have a full stop.)

        I would assume that any parenthetical statement spanning multiple sentences would have full stops on each, even if inline.

        1. Strangeite says:

          Strunk and White is as close as you are going to get to the divine word of God, when it comes to grammar.

          1. Sheer_Falacy says:

            Hundreds of variations, not everyone is sure they should be followed, and people will defend their own personal version to the death?

            That definitely sounds like grammar.

            1. Methermeneus says:

              Correction: That sounds like prescriptive grammar. Any decent linguist knows that real-world grammar is much more fluid. It’s just unfortunate that orthography looks so bad to anyone who reads a fair deal when it breaks prescriptive rules.

          2. nmichaels says:

            Strunk & White is pretty controversial among modern grammarians. White himself was known to split the occasional infinitive.

            1. Adam F says:

              As it should be. Not splitting infinitives is just a bit of stupid rule imported from Latin for no good reason.

              1. Chargone says:

                i seem to recall a few instances where in the rule is broken in the course of explaining it.

                i think that was in stunk and white.

                oh, fun:

                never end a sentence with a preposition.

                the INTENDED meaning of this rule is wrong.
                the LITERAL meaning of this rule is redundant.

                if it’s ending a sentence, by definition it must be a postpostion, not a preposition.

                english quiet happily puts some of it’s adpoistions (prepostions + postpositions + *shrugs*, the class of word meant by ‘preposition’ here) at the end of the sentence when using some structures though.

          3. anna says:

            And I invite all fellow English-speakers to join me as grammar heretics. Language Log is a good place to start:


            Fun reading on Strunk & White (links may contain strong language in large fonts):


          4. The best that can be said of Strunk & White is that not every grammarian thinks it is entirely incorrect.

            1. Darkness says:

              What about Strunk/White?

              <a href=""xkcd/a

        2. decius says:

          Inline parenthetical statements cannot span as much as an entire statement. You can’t put div elements inside span elements, either.

  3. burningdragoon says:

    You know what the problem is. For so many years, people never learned the right way to do punctuation and quotes because they could just cheat and put the period directly underneath the quotes. Now everything is on computers and most people don’t knows what’s correct.

    1. Pete says:

      Perhaps the period-under-quotes option should be declared the right one. After all, all we would need to do is modify the ASCII/Unicode tables and then update every single computer and other electronic device with the new version. Piece of cake.

      1. Soylent Dave says:

        Or modify word processing standards to turn ,” into a ‘period under quotes’ character after you type it in.

    2. Christopher says:

      I’m pretty sure that’s only possible when writing by hand. The way old type-setting worked way back in the days of the printing press prevented event that simple solution.

      And it was back then that a good majority of the rules we follow today were set in place.

      1. Esteis says:

        Actually, in the days of lead type this would be dead simple “” just cut and combine. A quotation mark block and a period block would indeed both be of line height, but once you cut off the bottom half of the former and the top half of the latter, you can place them above each other on the line easy as pie. You could probably use the slug cutter — there’s a picture of one a ways down this lovely article.

  4. Paul says:

    Very interesting read :-)

    PS. Last sentence: single->since

  5. DogOfRaw says:

    Interesting, but the largest sticking point I found in this whole kerfuffel was the fact Vader said “No, I am your Father!”! Not ‘Luke, I am your Father.”. :P

    1. Factoid says:

      Thank you. I came here to say the exact same thing. I was feeling twitchy reading this oft-misquoted line over and over again.

      1. Rayen says:

        i thought he said, “No, Luke, I am your Father.”

        1. ClearWater says:

          I thought it was: “No, Luke, your father I am.”.

          1. Dev Null says:

            I always thought it was “No Luke, I am a whiny self-centered teenager, and all of this is just me pouting because Obi Wan sent me to bed without my legs.”

            That may be from one of Lucas’ retcon releases though.

          2. Uh, in proper Yoda grammar, wouldn’t that be “No, Luke, your father am I.”?

            1. nmichaels says:

              “Your father he is.”

              1. felblood says:

                “Your father it is,” said Yoda (emphasis mine).

                1. nmichaels says:

                  Umm, check your sources.

            2. Cuthalion says:

              I think it would be, “Your father I am.”

    2. Lame Duck says:

      Don’t worry, it’s only a matter of time until Lucas releases a new version that corrects the film to be in line with the misconception.

      1. Joel D says:

        It’s sad how this isn’t that unlikely.

    3. Rick says:

      Sorry, my bad. I couldn’t think of an example so twisted Shamus’ text from above the comment box to suit my needs.

  6. Pearly says:

    And, of course, this is all forgetting the all-important oxford comma. A misplaced comma can change the whole meaning of a sentence.

    For example, “Not bad for a Monday!” would be a declaration that whatever it was was being indicated was perhaps not harmful to the Monday itself. Try it with a different noun; “Not bad for a monkey!”

    It should be, “Not bad, for a Monday!” thereby indicating that the Monday (or monkey) has not performed below the expected parameters.

    Also, you’re meant to put a comma between the end of the nesting sentence and the quotation mark.

    1. BeardedDork says:

      That’s not an oxford comma, it’s just a comma. An oxford comma is the optional comma before the ‘and’ or ‘or’ in a list of multiple items.

      1. Strangeite says:

        My favorite example of why the Oxford comma is important is the following.

        We invited the strippers, JFK, and Stalin.

        Which means that you invited some dancers, the former president and the dude with the ‘stash.

        Without the Oxford comma the meaning changes.

        We invited the strippers, JFK and Stalin.

        Which means you invited the exotic dancers named JFK and Stalin.

        1. klasbo says:

          I have an urge to write it as
          We invited the strippers; JFK and Stalin
          but I don’t know if it’s correct. If it were part of a larger sentence, I would write
          We invited the strippers – JFK and Stalin – and a baboon.

          But I have no idea what I’m doing.

          1. tengokujin says:

            We invited the strippers: JFK and Stalin.
            We invited the strippers, JFK and Stalin.
            We invited the strippers – JFK and Stalin.

            1. Peter H. Coffin says:

              Thank you!

            2. ngthagg says:

              I’m not a fan of the dash version. Similar to the semicolon, it should be a separate thought.

              ie, Darth Vader WAS his father–not that it made a difference to Luke.

              1. tengokujin says:

                I’ve only written out what are nominally correct. In more typical use, the colon or comma versions tends to be… well, better.

          2. The Rocketeer says:

            As far as I know, semicolons are used to link two complete sentences which grant each other a larger meaning.

            John missed lunch that day; his car broke down.

            Each is a complete thought in and of itself, but may be linked by a semicolon since the two sentences express a single larger thought.

            A colon, meanwhile, links a complete thought with a partial thought when they complement each other.

            John’s worst fear was realized: a missed lunch.

            The first thought is a complete sentence and can stand by itself, but the latter is not and cannot. But the colon links the two and makes the fragment ‘okay’ by bolting it onto a relevant complete thought.

            This is also why colons are used for lists.

            John bought groceries later: eggs, bacon, and milk.

            It would be pretty simple to make that example one sentence, but longer lists or more complex sentence structures can make a list following a colon the more elegant presentation.

            What I can never figure out is if the two can be combined.

            Then John bought loads more: ham, cheese, cabbages, cereal, butter, rice, Hot Pockets, sardines, spaghetti sauce, pickles, and armloads more; he realized later you shouldn’t shop hungry.

            Correct? I don’t know. It seems proper to me; the sentence and list complement one another and are properly linked by a colon, but is it proper to then append with a semicolon another complete sentence that complements both the preceding sentence and fragment as a whole? I think it can, but it often looks rather inelegant and can be difficult to read.

            There is also a sort of order of operations here, as well; an exclamation point or question mark can override a colon. Technically, they override a semicolon as well, but since semicolons only link complete thoughts, it never warrants investigation or confusion. I actually did this once already, if you care to look for the example above. Here are a couple more, though.

            Mere dinner? It was more a banquet.

            Tragedy! John has burst!

            Both are incomplete and complete sentences that would otherwise link with a colon, but the different punctuation marks take precedence here since they’re more important for relaying intent.

            I advise not to use colons or semicolons too often, though. They become ungainly if used too often, and sometimes it’s better to just use a regular period or conjunction if you’ve started dropping too many.

            1. krellen says:

              I think your colon/semicolon sentence looks fine, but I am overly fond of both and use them far too frequently.

            2. klasbo says:

              Semicolons for combining two full sentences (where the second somehow contextualizes or further develops the statement of the first) is the most common way I use them. The reason I wanted to use a semicolon for the list (this may be “wrong”, according to some standard) is because I think of the colon as starting a new sentence, the comma as ambiguous, and the hyphen as “without closure” (like a single quotation mark or parenthesis).

              The problem with these kinds of examples is that they are taken so entirely out of context. There is always a way to re-structure the surrounding text in those situations where something is ambiguous.

        2. Meredith says:

          I’m a big fan of the Oxford comma. It should absolutely be the standard. Saves confusion and just looks better, I think.

          1. BeardedDork says:

            I agree. That’s why I’m always quick to leap to the oxford comma’s defense.

          2. HiEv says:

            I’m also a huge fan of the Oxford comma, though I’ve been calling it the “serial comma” for a while now due to Wikipedia calling it that.

      2. Pearly says:

        Fair enough. My mistake. Not the first, won’t be the last!

  7. Deadfast says:

    This gets even funnier when you realize people can’t even agree on a common standard. But that’s hardly something that would surprise a programmer.

  8. Ingvar says:

    Syntactically, the three things inside the for (A; B; C) aren’t statements, they’re expressions. So you’re not leaving a statement end marker our, you’re just happening to re-use it for an expression separation in one single case (note that a statement can consist of only an expression, but a statement never has a value and that’s how you can tell the difference).

    1. Darkness says:

      The statement of the for loop should be in braces. Not required unless one really, really enjoys debugging nested for loops.

      After a several weeks chasing down a contractor’s (and I was contractor at the time as well) bugs all related to very complex expressions in for loops I changed my coding standard to stop that and added the braces.

      1. Ingvar M says:

        I will (in plain C) occasionally have a braceless body to the for loop, but if so, it is a single statement and fits ON THE SAME LINE. Ahem, sorry.

        These days, I either just indent the body of my for loop or I *have* to use braces (because not doing so is a syntax error).

  9. Amarsir says:

    I’ve been told Americans put the punctuation inside the quote and Europeans outside. I have no idea if that’s true or not, but in my (non-published) writing I eschew the “punctuation always inside” rule under the theory that if enough people change then the standard will follow.

    1. MichaelG says:

      Is it true that Americans write “1,000”, and Europeans write “1.000”? I seem to have seen that once in awhile.

      1. klasbo says:

        Pff, 1à—10³ is the one true way.

        There are local variations on who use ‘,’ or ‘.’ for the decimal point, and there are equally confusing variations on who use 1,000, 1.000, 1 000 or 1’000 as thousand’s-breaking things.

        The one that causes the least confusion is ‘.’ for decimal, ‘,’ for separations in a list, and a non-breaking space for grouping thousands, because this is the most “international” one. Also: programming.

      2. arnsholt says:

        Yes. I’m not sure about the British, but mainland Europe at least uses comma as the decimal separator and periods for thousands.

        1. Ingvar says:

          The Brits would write 1,234.56 for 123 456 divided by 10. The Swedes would write 1.234,56 (or 1 234,56 !) for it. I cannot confidently comment on any other European country (but I believe most of them do it the same was as the Swedes).

          1. nmichaels says:

            Those Brits and Swedes are both wrong. It’s 12,345.6.

            1. Ingvar M says:

              Doh! Divide by 100, then. :)

          2. SciK says:

            In France: 1 234,56.

          3. Mephane says:

            In Germany it’s either

            1 234,56

            However, the third variant, while correct, is highly discouraged, and in numbers with only 4 digits before the comma, even the space is usually omitted.

      3. Esteis says:

        That’s the Dutch style, too, indeed. In fact, this is one of the components of the great blessing that is localized Microsoft Excel. Imagine that I have a Dutch version of Excel. I copy a bunch of data from, I dunno, a table on the web or summat. Blammo! I can have fun changing every decimal period to a decimal comma!

        Now, imagine that I have done so, and added a few calculations, and then send you the spreadsheet. Which you open with your US version fo Excel. Blammo! Have fun changing every instance of =SOM(...) to =SUM(...)! Oh, and good luck figuring out what GEMIDDELDE() means. (Apologies for the bilingual pun in the previous sentence.)

        At least the Dutch-localised version preverves the English functions, so I can still type SUM().

    2. Jexter says:

      I’ve heard so to, and a quick Google search turned up a source to support that. It’s apparently a difference between American and British English.

      1. Chargone says:

        NZ English has punctuation inside the quotation marks, and uses 12,345.67

        numerical fun: i don’t know about the decimals, but for the part before the decimal place, japanese writes it as 1,2345

        it’s actually odd how many of the various little ‘covert’ culture things (the things you don’t notice and wouldn’t even be AWARE of unless someone screws up in a significant manner, as either a native or a guest) in NZ are the same as the US usage. but for anything there’s actually controversy people Care about (for given values of care) we don’t.

        (it’s Aluminium, damn-it! curse you american spell checking devices!)

  10. Atle says:

    Don't you hate when people say “Not bad for a Monday”?
    I hate when people say “Not bad for a Monday.”

    I hate this!

    1. Sumanai says:

      Above it’s suggested in Britain it’s

      I hate when people say “Not bad for a Monday”.

      Which to me looks cleaner, so I’ll have to remember to use that.

      1. Atle says:

        I have to say I put the punctuation outside the quotes myself. Even when I know it’s wrong. A little rebellious, but I think we need to dare a little and stand up for what is right!

        What are we, if not free men?

        1. Sumanai says:

          Like I say below, in creative work rules are meant to be broken. You just need to know that you’re breaking a rule, why the rule exists and feel that it’s justified in that specific case.

          There’s a video where Stephen Fry talks about language:

  11. Johnny says:

    As a programmer and writer, I find this quite amusing. I often wish that human language was more structured and less vague.

  12. rrgg says:

    What are you talking about? If the paper’s output is all cout strings then it doesn’t matter which order the characters and symbols are in.

  13. MichaelG says:

    Shouldn’t those last two “cout < <" be "cout <<"?

    Please install a compiler before your programming talents atrophy. That would be a loss to humanity.

    1. noahpocalypse says:

      What’s wrong with a space between < and <? I'm pretty sure that'll still compile.

      1. Ingvar says:

        If it does, “cout < < endl;" probably means something completely different than "cout << endl;" but I am FAR from a C++ language lawyer.

        1. Shamus says:

          To clear this up:

          The space in my original post is the result of the code-to-html parser trying to do my thinking for me. It has a horrible time with greater-than / less-than signs, because they’re used in HTML.

          1. Ingvar says:

            To be honest, I wouldn’t have been (that) surprised to learn that “blah < < blahblah" was valid C++. Any language that takes an honest left-shift and turns it into an output operator is, well, I have views and they're strong.

      2. MichaelG says:

        error C2059: syntax error : ‘<'

  14. Tohron says:

    I always put brackets around the contents of a for loop – even if I don’t have to, I just think it looks better.

    1. klasbo says:

      The question is if you should do



      I use the first one for if, while, for, switch and function implementations, and the second one for structs and classes. Enums go on a single line.
      And just like that, I make sure everyone is equally pissed off.

      1. ngthagg says:

        I used to be a fan of the first, but now I use the second format exclusively. I like to be able to match my opening and closing braces visually.

        1. burningdragoon says:

          Same here. For a while I would wonder why anybody would put the opening brace on a new line… until I started preferring that way myself.

          edit: bah, my formatting fun backfired. removed.

        2. Alan says:

          I went the other way; I originally liked the opening brace on its own line, but I’ve since moved to cuddled braced as I prefer the increased density of code.

        3. Sumanai says:

          I heard a rule that stated that you should, or may, use the first when there’s only one line inside, second if it’s longer. So:




          1. Blake says:

            Sounds more like how you can exclude the brackets entirely for single expressions like
            if (blah)

            But please don’t do that, if you’ve got a macro that actually has 2 expressions in it, for example “#define BIND_TO_SCRIPT(fn) BindFunctionToScript(#fn, fn); AddToSomeTable(fn);”, which might be completely valid binding, but if you had
            if (bindingEnabled)

            Then if binding was disabled AddToSomeTable(Foo) would still be getting called. This problem would be worsened if the original BIND_TO_SCRIPT macro only had a single expression but was updated later causing these bugs to appear.

            Friends don’t let friends exclude curly braces.

            1. Sumanai says:

              I think the point of the rule I mentioned was that the coder could have their more compact style brought by excluding braces, but to still actually have them.

              I never exclude braces because of a) potential unforeseen problems like you mentioned, b) if I need to add something I don’t need to add the braces themselves, just move them and c) I just think it looks more sensible to have them since it makes things more consistent.

              I’m actually slightly bothered by Python because it excludes them pretty much completely, if not completely.

        4. Trevel says:

          I used to use the second exclusively, but after spending a few hours hunting down a

          for (i=1; i <= 5; i++);
          // Why does this only execute once?

          error, I've seen the value of the former.

      2. Atle says:

        I always use the first one. I hate wasting code lines and get less code on the screen when it doesn’t add anything to structure or readability.

        I also like Python for getting rid of unnecessary brackets all together.

        1. Sumanai says:

          No brackets are unnecessary! Real coders use Common Lisp.

          1. Atle says:

            I’m definitely not a real coder. Could never grasp handling several variables and doing different things to them in Lisp (Or Scheme).

            I did work with a Lisp programmer on a C++ project once. He made C++ look like Lisp, with several levels of nested new statements.

        2. Blake says:

          I’m the opposite, I think whitespace helps readability.
          Give me
          if (blah)



          } else

          any day.

          If your functions are too big to fit on the screen anyway they’re probably too big.

      3. bassdrum says:

        It’s strange, I’ve seen the way people do this break down by language lines–every bit of code I’ve seen people write in C++ and its derivatives (i.e. C#) has been in the second format (hell, Visual Studio even changes it if you write it differently), and every bit of Java code I’ve seen has been the other way. Then, the people who started one way just seem to keep using that style elsewhere.

        I don’t claim to be any sort of expert in the matter, and it’s not like I’ve spent much time at all analyzing code samples, but that’s just what I’ve seen in my experience.

    2. El Quia says:

      It also prevents when you go back at it to make a quick change, add another line and forget to add the brackets that are now necessary. It leads to fun.

      So yes, in the words of the head of the programming department at an old job: “Always put the brackets in for loops. Not doing it is like putting rat poison on a croissant: maybe nothing will happen, but maybe someone will eat it” :p

    3. Nick says:

      Brackets, parentheses or braces?

      1. Darkness says:

        Do you mean squiglies?

  15. Dev Null says:

    If the punctuation adds relevant information (like a ? or !) I just put it in anyways. Rearrange your sentence so the quote isn’t at the end, and it looks fine:

    Doesn’t the phrase “Not bad for a Monday!” drive you nuts?

    Its still grammatically incorrect, according to style-guide-guys-who-need-to-get-out-more, but it conveys information effectively to the reader, and English is a living language. Besides, I don’t have an editor (as should be profoundly self-evident…)

    EDIT: and then I realised that the grammatically correct way to convey the same information would be to say:

    Doesn’t the exclamation “Not bad for a Monday” drive you nuts?

    …but my way is shorter.

    1. krellen says:

      Brevity may be the soul of wit, but it is not the soul of communication.

      1. ps238principal says:


  16. Meredith says:

    In America, we tend to always put the period inside the quotes, but I think we’re wrong about half the time. The rule, as I remember it, is to place the period inside the quotes when the entire sentence is a quote and outside them when it’s not.

    e.g. According to the Journal of Science Guys, “interesting fact”.

    1. ngthagg says:

      That’s the rule I use. The part I still struggle with is this:

      “Are you my father?” asked Luke.


      “Are you my father,” asked Luke.

      And somewhere deep inside me there’s the tempatation to do this:

      “Are you my father,” asked Luke?

      1. Sumanai says:

        So somewhere deep inside there’s a sadist just waiting to get out?

      2. krellen says:

        The first is correct.

  17. In my opinion, as long as the structure is consistent within the same work then it is okay even if it does not meet typical conventions.

    The human mind is able to adapt rather quickly so after reading a few lines the rest should be readable more easily.

    So whether it’s a book or a software source code, just keep it consistent.

    Myself I’m rather strict these days when it comes to source code.
    Take C for example, TAB’ed indenting and { and } must start on it’s own line and end on it’s own line. (allows more for a more easy visual indicator of the nesting level for example.)

    I never really liked seeing { at the end of some line, and later } at the start of it’s own line. Without a advanced syntax/highlighting IDE it’s very hard to see which { matches which }.

    Example1: (which I hate)
    if (x=0) {
    //something something

    Example2: (Ah! Much better!)
    if (x=0)
    //something something

    1. nmichaels says:

      This code is why lots of people suggest putting the constant on the left side of comparisons in conditions. (x=0) and (0=x) don’t mean the same thing, but (x==0) and (0==x) do.

      1. oops! Sorry. I meant ==, = is a habit from PureBasic that I code mostly in!

    2. HiEv says:

      Either of those are fine with me, as long as proper indenting is used.

      Example 1 has the advantage of allowing me to see more code on the screen at once, which is especially nice if you’re nesting multiple “if” statements or the like. As long as the “if” (or whatever) line is indented the same as the “}” and the stuff inside that section is all indented, then they’re easy enough to match up.

      Example 2 makes it a bit easier to match up the curly brackets and be sure that you aren’t missing the starting bracket though.

      However, if you’re going to use one or the other, do it consistently, not a mix of both. That bugs me.

      1. Atle says:

        I always use version one. It saves space, and I think it is more readable. I see no need to match brackets. I use indenting to know where the start of the code block is.

        Also I like compact code blocks to separate different sub tasks, and use spacing between them to make code structure more readable. Too much spacing everywhere, and this effect is lost.

        Also I like more code on the screen, so that there is less scrolling up and down.

        Everything is about compactness to save screen space, and deliberate use of spacing to add structure.

        Indenting is imperative with any style. It’s not easy matching brackets in any code style if the code is not properly indented.

        1. Blake says:

          I always use the second, and if the body of you’re functions (excluding variable declarations) don’t all fit on a single screen or so then it’s probably time for a refactor.
          The only reason you wouldn’t want to have the extra functions would be if you had a tight loop in a time critical situation and you didn’t want the function calling overhead, but in that case inline functions are your friend.

          I absolutely agree with the spacing and indentation, but saying ‘I use indenting to know where the start of the code block is.’ doesn’t help any other programmers that read your code that do use braces as visual clues.

        2. Darkness says:

          Back in my original coding days CRTs had 24 lines. Then 32 and I still use the first example to save space. But the statement is tabbed over.

    3. LintMan says:

      TABs in source code are the spawn of satan, unless you have complete and utter control over every tool used by every person who edits, views or outputs that code. :)

      Another pet peeve of mine is if and for statements written like functions, with no space between the keyword and the paren:
      for( x=0; x<10; x++ )

      I used to prefer the K&R style braces with the opening brace on the same line, but years of coding standards with the separate line style have convinced me that is better.

      As for using (0==x) instead of (x==0), I totally see the merits, but it just reads "wrong" to me. I find it incredibly awkward to think "if zero equals x", when x is the thing under consideration.

      1. Blake says:

        Tabs to indent, spaces to align if you really feel the need.
        My tab sizes are different to most of my colleagues (I have 2 spaces per tab instead of 4), so if people used spaces to indent at the start I’d have much wider code than I like. Tabs at start give everyone the option to view the code as they wish.

        Spaces for aligning if you really like certain things lining up means as long as they’re the same number of tabs at the start the aligning will still work for everyone.

        Follow those 2 rules and it should always display optimally regardless of what IDE settings people are using.

  18. noahpocalypse says:

    Wait. So

    _Don't you hate when people say “Not bad for a Monday!”?_

    ISN’T syntactically correct? I do that frequently.

    Screw editors. I’d rather have incorrect grammar and a more precise meaning than vice versa.

    1. Strangeite says:

      Oh no. The Illuminati is made up mostly of editors and Freshman English teachers.

      You can expect your front door to be smashed in any moment.

    2. Sumanai says:

      I’d just drop the exclamation mark, but I don’t see much use for it anyway. Or as was mentioned above:

      Don’t you hate when people exclaim “Not bad for a Monday”?

  19. Delta Force Leader says:

    Shamus, I’m taking C++ in college right now so I decided to open Visual Studio 2010 and test your code:

    for ( x=0; x<3; x++;)
    cout < < "The value of X is:" << x << endl;

    Visual Studio flags the last semicolon saying it was expecting a ")" instead. It will not let you build the program with that semicolon there.

  20. ngthagg says:

    If you ever get in an argument with someone about this sort of thing, there’s an easy test to see if they are going to be reasonable about it. When they correct you, simply respond with, “For all intensive purposes, it means the same thing.”

    If they laugh, it’s cool. If their head explodes, it’s best just to walk away.

    1. ngthagg says:

      Incidentally, he one thing that’s driving me crazy with the examples is that (I think) it should be:

      Vader explained, “Luke, I am your father.”

      rather than:

      Vader explained “Luke, I am your father.”

      1. HiEv says:

        Yes, I was also noticing (read as “OCD obsessing/annoyed about”) the missing comma.

      2. Moridin says:

        I’m fairly certain that having a comma in there is incorrect. If anything, there should be a colon as in: “Vader explained: “Luke, I am your father.””

        1. Chargone says:

          standard thing is ‘(person speaking) (manner of speech), “(quote).”‘
          or ‘ “(quote),” (manner of speech) (person speaking)’

          other punctuation overrides the full stop of comma at the end of the “(quote)” section.

          that said, Explained might want a :, for all i know. but i think that depends on the surrounding text somewhat, and if you put the fact that he explained at the end, it gets a , again either way.


          there’s a reason why i do not use : at all except for starting lists and completely ignore the existence of ;.

    2. Sumanai says:

      Conversely, if you or someone else corrects a writer who then responds “For all intensive purposes, it means the same thing” stop reading the writer’s stuff. If they don’t understand that while it means the same thing it might not be as readable or easy to understand, they’re not good at their work.

      And that’s disregarding the fact that the response implies that they’re not ready to take criticism, which is also a bad sign in a creative person.

      Edit: While it’s true that “rules are meant to be broken” in creative work, the decision needs to be conscious and not made flippantly.

      1. lasslisa says:

        I am fairly sure that the joke was “intensive purposes” instead of “intents and purposes”.

        Got to say though – saying something stupid to see whether the other person will believe you’re stupid doesn’t seem like the best way to go about things.

        1. Sumanai says:

          I just figured it was a misspelling brought on by a spellchecker.

          Edit: What if the person reacts with a look that says “what are you talking about”?

          1. Chargone says:

            actually, ‘intensive purposes’ is a common error for ‘intents and purposes’. why, i have no idea, because it makes No Damn Sense.

            recently i found a multi-layered version of this error:
            ‘for all extensive purposes’. … they stuffed up Twice.

            intents and purposes is like ‘cease and desist’. in common speech it’s redundant and used only for emphasis (more casual wording would use the word ‘basically’ and be arranged slightly differently) but it comes from ‘legalese’ where in the two are different and it’s covering all the bases.

            another irritating error is that, in a lot of american dialects, ‘do’ and ‘due’ are pronounced the same due to yod dropping. one would expect this to lead to using ‘do’ in places where ‘due’ should be. instead it usually leads to the reverse, turning a phrase like ‘make do’ where if you read it as it’s component parts it doesn’t make much sense, but as a whole means exactly what you’re going for, into ‘make due’ where, read as is, it has a valid meaning… which makes no damn sense in any context where you would use ‘make do’.

            then there’s replacing ‘ado’ with ‘adue’ … which if you read it as written comes out as french for ‘good bye’

            rumble grumble pet hate rant rant rant.

            but yeah, if they respond that ‘for all intensive purposes, they’re the same thing’ you shouldn’t be reading them because they clearly have no idea what they’re doing.

            ‘what are you talking about’ expressions means either they have no idea (and if you can explain it to them and they get it you’re all good, and otherwise clearly it’s not worth the effort) or you’re wrong (in which case… you need to look into that more.)

  21. Jason says:

    I submit that the lack of a ; after control loops is intentional, to highlight that “I am not like the other lines of code – I decide things”
    If, for, while, do, else, elsif, elseif, unless – control “loops” all skip the endline character of their language – with a few exceptions.

    It’s made sense to me – control is not the same as the stuff inside it, and needs to look different.

  22. Deoxy says:

    Stuff like this is why I love this site. Well, one of the reasons, anway.”.?'”!

  23. nmichaels says:

    I don’t know about C++, but that is not valid C. The compiler says this:

    for.c: In function “˜main':
    for.c:5:23: error: expected “˜)' before “˜;' token
    make: *** [for] Error 1

    What’s a computer without a compiler for?

    Edit: Huh, it is valid in C++. What a crazy language.

    1. Zukhramm says:

      What? C++ crazy? Who knew?

    2. MichaelG says:

      Amusingly (for this discussion), this is valid:

      int j;
      for (int i = 0; i < 10; i++,j++)
      { stuff }

      In other words, you can put multiple statements inside the for expressions, separated by commas.

      1. Eldiran says:

        That’s awesome! I had no idea.

      2. nmichaels says:

        Yeah, it turns out the comma operator is a thing. This is valid C code:

        a = 1, 2, 3;

        It’s the same as

        a = 1;

        but more fun! Use it to confuse your friends and rile your coworkers.

        1. Blake says:

          I’ve thus far only found 1 valid use for the comma operator and that’s in macros when you want to be able to do multiple things in one expression.
          For instance our code base has something rather like

          define ASSERT(expr) (void)((!!(expr)) || (AssertHandler::GetInstance().Assert(__FILE__, __LINE__, (#expr)), BREAKPOINT, Nop(), false))

          in it.

          I’m not even certain what that last false is for, but the rest of it means if expr is false then our assert handler will do it’s thing then the game will break on the same line (so you don’t lose any stack information if it was at the end of a scope (Nop() does nothing).

          Using similar things you could also return the actual input variable if you wanted so if you had
          #define ASSERT2(expr) AssertHandlerVerifyAndDoThings(), expr
          You could write
          if (ASSERT(blah))

          and have it so in a debugging environment the Assert handler would cause you to break but otherwise OhNoe() would just run instead.

        2. xKiv says:

          Actually, it’s the same as:

          Comma returns the value on the right (I just tried it). Which explains the final “false” in Blake’s macro – it’s there so that ASSERT( /* anything that isn’t true here*/ ) is false. This is necessary, because the type of Nop() probably isn’t compatible with the type of !!(expr) (i.e. it’s there so that the damn thing will compile before the value is completely thrown away by the (void) cast).

      3. Sem says:

        Well, I don’t know about C++ but I just discovered that in C# this is valid :

        for (;;) {<stuff>}

        Thus creating an infinite loop (unless you use break in the <stuff>). You could also replace all while loops with this :

        for (;<condition>;) {<stuff>}

        and all do while loops with this :

        for (;;) {<stuff> if (<condition>) break;}

        So basically, the for loop is all you will ever need.

        And while we are at the topic of confusing programming, here is a page I discovered some time ago : How to write unmaintainable code.

        1. Shamus says:

          I worked with a programmer who used an empty for () along with break instead of do / while.

          1. Rick says:

            I’ve heard of people being told to avoid do/while loops in their programming. I can only assume that they were learners at the time and hadn’t yet been taught to ensure that the loop would eventually exit.

            Last I remember one friend still considers for loops to be less “volatile.”

        2. Sumanai says:

          You used an “if” there, on the last example. So for and if are all you will ever need?

          1. Blake says:

            You could replace that if with a for(;;) goto end; if you really wanted?

          2. Sem says:

            Sorry, I wasn’t clear enough there. I meant that ‘for’ will be the only loop construct you will ever need, not the only statement.

        3. Jaco says:

          The for(;;) loop is actually just shorthand for a while loop, anyway.

          int i = 0;
          while (i < 10)
          // Stuff

          is the same as

          for (int i = 0; i < 10; i++)
          // Stuff

          1. xKiv says:

            Unfortunately, it’s not the same. If you do “continue” inside the for version, it will do the i++. If you do “continue” inside the while version, it won’t.
            Have fun debugging inifiloops brought in by people taught by people who simplify too much.

            1. Shamus says:

              Thanks. I KNEW the two were different and it was driving me crazy that I couldn’t remember how.

              Of course, the above my be desired behavior. One of the most crazy things to write is a parser, as almost every type of file needs a different sort of loop. One needs you to crank through characters or words, looking for some special bit to say “This is important”. (Because the rest is all comments.) Some need a fixed loop. (because the spec says exactly how many fields should be there, and if it’s wrong you can abort.) Some need a do-while because you have no idea how long. In some, you don’t know what to do with one field until you read the next few.

              Sometimes to want to continue a loop to grab another field. Or sometimes you DON’T want to increment some counter because you’ve just read i some useless trash. Or you need to read a bunch of crap before you know if any of it is useful.

              Maybe it’s just because I’ve written a lot of parsers, but I’ve found they’re marvelous for testing your knowledge of looping logic.

    3. Delta Force Leader says:

      How did you get it to work in C++? When I tried it I got the same error message you received in C.

      1. nmichaels says:

        Goodness, I tested it incorrectly. The C++ error message is a bit more exciting than the C one:

        $ g++ -Wall -o for for.cpp
        for.cpp: In function “˜int main()':
        for.cpp:5:23: error: expected “˜)' before “˜;' token
        for.cpp:5:24: error: expected primary-expression before “˜)' token
        for.cpp:5:24: error: expected “˜;' before “˜)' token

        Oh well, C++ is still crazy.

        1. Sumanai says:

          That’s a pretty crazy error message.

  24. General Karthos says:

    The most infuriating rule for me is that when you’re quoting ANYTHING at all, the punctuation always goes inside the quotation marks.

    The quote:

    He said he was being “serious”.

    Looks right to me. But it’s actually wrong. At least in common English, the correct way to write that is:

    He said he was being “serious.”

    Which just looks WRONG.

    1. HiEv says:

      Tell me about it. As a programmer it feels wrong to me, but as the son of an English teacher, I know it’s right.

      1. Pete says:

        I always said that if something looks right and the rules say its wrong, the rules are wrong. Unfortunately my czech (eq. to english for you lucky native speakers you) teacher did not agree.

        1. Sumanai says:

          Teachers’ job is to get you to follow the rules. And if they’re good at their job, they’ll teach you why the rule exists. Then if you break it later, you’ll be breaking it consciously so you can think if the reason why it’s followed applies there or not, and whether breaking it is worth it.

          Same thing for reading TVtropes. When you write you’ll notice that something is a specific trope. Is it a cliché? Does it work within the context? Is it justified and does it need lampshading? It’s important to ask these sort of questions as you’re writing, or rewriting, something.

          Of course being self-conscious doesn’t work for all writers, but I believe that for most it does.

    2. Simulated Knave says:

      That’s actually debatable. In legal academia the first way is correct. Or, at least, not incorrect.

    3. Dev Null says:

      This riles me especially since, quoting the written word, you must sometimes add punctuation which is not in the quoted text:

      The first three words of the novel were “It was the!”

      Which not only looks wrong, it puts stuff inside the quotes that is not quoted, if you see what I mean.

      1. Chargone says:

        my natural reaction to that is to reword the entire thing to avoid it. the end result is either more formal or more casual though.

        then again, NZ english does this to pretty much Any awkward construction. (seriously, if you find an argument about how to say or use a specific word or structure, odds are good NZ english has an expression that says the same thing while completely avoiding the controversial issue, and that That is the common usage here.)

  25. Mephane says:

    Regarding this snippet:

    for ( x=0; x<3; x++)
    cout < < "The value of X is:" << x << endl;

    This gets even weirder:

    for (x=0; x<3; x++, cout << "The value of X is:" << x << endl);

    Also lovely: overloading the comma-operator. There lies power to drive people into the madhouse.

    1. nmichaels says:

      Overloading the comma operator? What kind of sick, twisted mind thought this stuff up?

      1. Mephane says:

        You may thank Bjarne Stroustrup for this. I don’t know if it was his idea, but the mere fact that it is possible means that he did not fiercely veto this abomination.

        Also coming to town: implicit virtual function overrides. So many runtime-only-detectable headaches can come from this. C++11 finally introduced explicit overrides, but they’re optional in order to not break existing code. Sigh.

        1. MichaelG says:

          This is my nightmare. If you have a function which takes a class instance, and that class has a constructor, it will automatically create an instance if you call with the wrong argument type:

          class Thing
          Thing(int a) {}

          void testing(const Thing& t) {}

          testing(2); // Creates a Thing as side effect

          1. Mephane says:

            Well but there are instances where this is desirable, for example when the argument is a std::string and you pass a hardcoded c-string. But I agree that it should have been the other way around, having to mark implicit conversions and having anything else automatically explicit would be better.

            1. Blake says:

              Even c-string to std::string implicit conversions bother me. If I accidentally write Function(“blah”); inside a loop I don’t want to be creating std::strings everywhere by accident. If it was marked explicit it would force me to either write for(;;)Function(std::string(“blah”); or more likely std::string sBlah(“blah”) for(;;)Function(sBlah);

              Implicit conversions are almost always bad juju.

              1. Mephane says:

                Maybe then it’s just that I am too young, heh. I prefer the current situation with c-string -> std::string auto-conversion because it lets me treat string literals in code almost the same way as numerical literals. It’s the closest you can probably get to being similar to a built-in type. And if I want to pass the same string to something multiple times, as in a loop, I think it’s better to have a named constant for that anyway (the same goes for numeric constants), and that constant should’t be a #define, but an actual std::string constant, where possible even static.

          2. nmichaels says:

            So glad I don’t have to write C++ code. Sure, I write C all the time, and it’s missing some great features, but I can get those features in higher level languages that don’t have C++’s horribleness.

            1. Mephane says:

              But whenever I see the C code (or maybe just the specific C code I get to see), I am glad that I have proper classes instead of opaque pointers and hundreds of we_must_make_globally_unique_function_names functions.

              1. nmichaels says:

                That’s just bad C. I’ve worked places with that sort of garbage, but where I currently work we have over a million lines (1.3 at last count) of C code and it’s actually sensible. Static functions are your friend.

    2. Steve says:

      I burst out laughing when I read “overloading the comma-operator”; it brought up a mental image of a writer trying to do that in a written document.

      “The use of the comma-operator in the following document should be taken to indicate that the proceeding word should always be read as an intransitive verb.”

      Definitely power to drive people into the madhouse. :-)

      (Oh… should I have left out the period before the smiley?)

  26. Arctem says:

    Didn’t you start dual-booting Ubuntu a while back? That should include gcc by default.

    1. Shamus says:

      True! So technically I still have a compiler. I just forgot about it.

  27. Maleldil says:

    This code:

    for (int i = 0; i < 8; i++;) {
    // do nothing

    Does not compile in Java, so I'm tempted to think it wouldn't actually work in C/C++ either. It also makes the end of the for loop look like its winking at me.

  28. Kelly says:

    Hey Shamus, I was just wondering, how does this particular bit of news make you feel?

    Basically, Obsidian made no money off New Vegas sales.

    1. Sumanai says:

      That shouldn’t have surprised me, but it’s just so dumb that developers often get paid by Metacritic scores. Might as well get paid by the amount of comments on the forum.

    2. krellen says:

      My response is “thank god for Kickstarter”. I may never buy a published game again.

    3. Darkness says:

      They made no BONUS for NV based on missing Meta by one point.

      1. krellen says:

        They made a game that sold five million copies, and were paid the same as if they had made a game that sold five copies. Whatever the technicalities, it’s still fucking bullshit.

  29. ps238principal says:

    I hate to say it, but any time someone tries to “make sense” of English/grammar/whatever, it puts me in mind of Ben Franklin and his phonetic alphabet.

    It’s a constant war between usage and those in editorial/academic positions that seem to have the greatest sway. While the rise of the non-word “irregardless” and the nonsensical pronunciation/spelling of “yea” as “yeah” annoy me to no end, I always remind myself that the best an unchanging language can hope for is to be used as a means of naming newly discovered organisms.

  30. Benjamin says:

    The talk about expressions and statements got me looking around a bit, and I found this and this pretty quickly, considering that I never knew about them.

    Just thought the programmers would find them interesting.

    1. Darkness says:

      Linus had a great argument with some random gcc guy on the linux kernel list and basically told him that yes what they did was correct by the definition of the spec but it was also wrong. Which summed up why he thought the guy should get off the list.

  31. David says:


    Don't you hate when people say “Not bad for a Monday”?

    Really is grammatically correct? I thought we were forced to even put that question mark inside the quotes:

    Don't you hate when people say “Not bad for a Monday?”

    1. ps238principal says:

      I think there’s supposed to be a comma after “say” as well.

      1. Chargone says:


        always a comma between the speaker and the spoken, unless it’s overridden by something else.

  32. Katesickle says:

    I find it interesting that programmers here take issue with non-programming grammar, because I have the opposite problem. My fiance tried to teach me to program once, and I had a terrible time accepting the idea that you could have parenthesis on a separate line from the information they were enclosing, like this:

    Blah Blah Blah

    That just looks WRONG to me.

    1. Mephane says:

      There are programming languages where whitespace actually matters, and I am not talking about Whitespace the esoteric language. For example, in F# you don’t have curly braces, the itendation of a function’s body marks what is part of the body (unless it is all written on one line, which ends where intendation is one step less deep or the file ends (it actually does not care whether you uses spaces or tab, or how many space, only requires consistent intendation for a given function body).

      let add(x:int, y:int) =
        x + y

      let mult(x:int, y:int) =
        x * y

      (yeah, no return there, whatever last line of a function’s execution produces is returned (consistency between branches is enforced by the compiler).

  33. mneme says:

    @Katesickle: That’s because you’re imposing outside grammar rules. In most programming languages, most whitespace is ignored — so putting the parentheses on separate lines from the statements they enclose is just the same as putting them on the same lines.

    Whereas in terms of English grammar, you’ve got quotes enclosing something that isn’t verbatm, which feels wrong.

    That said, a lot of ludicrous rules of English come from typography. In classic English (or even American) typography, when you had punctuation on the end of a quote that wasn’t part of the quote itself (eg, not an exclaimation or a question), you’d kern it underneath the enclosing quote. Sure, it was usually placed “inside” the source document, but it didn’t really matter; what mattered is that you were really combining the quote and period or comma half-characters into a single space. This makes a lot of sense whether you’re -thinking- of putting one inside the other or vice versa.

    1. bassdrum says:

      Then there are the times when whitespace isn’t ignored. Fun times.

      1. Well yeah, most languages, most times. Anyways, Whitespace is a joke language, if a turing complete one. for one that some people seem to think is a serious language (but where whitespace is significant) see the one based on an absurdist comedy show. Or going older, the proceedural (not programming) language that’s used to control most projects’ builds

  34. Rick says:

    Thanks for the reply, Shamus. This has bugged me for a long time as it just seemed so illogical to have nested elements finishing out of turn.

  35. Neko says:

    Also, rules for apostrophes. A casual survey of the internet is all you need as evidence that the rules are too complex, with too many exceptions and edge-cases. Don’t get me wrong, I understand them and use them correctly, but as a programmer the inconsistencies infuriate me. “its” and “it’s” is probably the worst offender.

    What English really needs is to separate out the symbols for possessive and for contractions.

    1. Rick says:

      its/it’s, there/their/they’re, your/you’re… the informal/casual language of general (read non “edited” content) internet is very bad for this.

      Interestingly tough the English language has a lot of edge cases such as you mention. I can see how learning it as a second language could be quite difficult. Take the “I before E except after C” rule for example. Only 44 words obey it. 923 break it.

      p.s. I almost put the closing bold tag after the period as if it were a closing quotation mark.

      1. Moridin says:

        I think most people who learn English as a second language aren’t even taught such rules(for a good reason, apparently). I know I never was.

      2. Chargone says:

        that’s because i before e except after c isn’t actually a valid rule.

        it’s most famous usage was in a movie that then proceeded to list exceptions to it (which included what day of the week it was when you wrote it down, from memory) before tossing it out as hopeless.

        also, english has a stupidly large number of ways to spell the name of the letter ‘e’

        any two vowel combination starting with e, except those where each vowel is pronounced separately (which would usually be fine if We Marked Stress. but we don’t.), -ey, -i (sometimes), e_(vowel), ie, and there’s probably a couple of others, but that’s thirteen, right there. then we have ‘silent e’ just to confuse everyone.

  36. Grammar is correct when it’s readable and correctly communicates the intent of the writer. Does it make your writing clearer when you put periods after quotation marks? Go right ahead. Screw anyone who says you’re not correct.

  37. SatansBestBuddy says:

    I’m pretty sure this is just one of the many hundreds of quirks of the English language that came from the way it’s evolved over the last few hundred years.

    That’s the key point, that English evolved rather naturally over the course of hundreds of years of use; rules were created and then dropped or changed mainly by the whim of the writer, who used it for whatever purpose he wanted. It could be business, it could be poetry, it could be lyrical, it could be rebellious, whatever the writer wanted, he could do it, and often times rules only grew out from the need to have others understand what the hell you’re writing. English today has hard rules only because it’s been refined over the years to have these rules, through a continuous, grueling session of Quality Assurance.

    Computer language is nothing like that. Coding language has a very specific function, and is designed to do that very specific function as quickly and efficiently as possible. There is no need for lyrical code, or poetic code, or especially rebellious code, just efficient code.

    Think of it like this; English is like a tree, constantly growing to support itself, rough but still well rounded and very sturdy, while Code is like a concrete building, square and smooth and solid, but with no life in it, only life that uses it.

    Even shorter metaphor than that, English grew naturally, Code was designed and built.

  38. TSED says:

    In MLA citation, the period goes outside of the sentence; ” if this was actually a quote of something it would end as I end this sentence” (citation ##).

    Non-standard punctuation marks go inside the quotation mark “like this!” (butcitationshowsup ##) and so on and so forth.

  39. ps238principal says:

    I think we all know the real power behind grammar, sentence structure, and pretty much the whole of the English language.

    It’s the person in charge of the squiggly underlines in Microsoft Word.

  40. BvG says:

    Germans would say: “We don’t understand the problem.” Altho they might be allowed to continue “rules are always arbitrary”, and not be berated for that at all.

  41. Kdansky says:

    You guys got it easy, only worrying about commas in a single language. I speak five, and they are all different. I’ve long since given up on comma/apostrophe rules, because I can’t remember four sets (Swiss German has no written form).

    And my wife is still recovering from learning English pronunciation for letters first, which makes no sense at all:

    ね is written “ne” in our letters, and pronounced just like that too, assuming you actually mean this phonetically (see which is 99% overlapping with German (what I’m native in) anyway.

    But you horrible people have to pronounce it “ii” instead, at least some times. So when she spells, she uses the English vowels, which are completely off: A is E, E is I, I is AI, U is IU. Considering that Japanese AND German actually work the same, this is cringe-worthy, because the German spelling makes more sense for me and her, but her brain is damaged by getting taught something completely superfluous.

    English spelling is an abomination for learners:
    bear, near, learn, read (present tense), read (past tense)

    That’s 4 different versions, and two words are completely identical yet are pronounced differently. I don’t think I know an example in another language where writing is identical, but speaking differs.

  42. DavidVS says:

    “English: A language that lurks in dark alleys, beats up other languages and rifles through their pockets for spare vocabulary.”
    “• James Nicol

    English does not borrow from other languages. It mugs them.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply

Your email address will not be published. Required fields are marked *