1. 39

  2. 18

    These questions are rather mild on the programmer. I got most of these after a few seconds of thought, and I’m not even a good C programmer.

    For achieving what this quiz is trying to do (teaching a programmer that he is unaware of many things going on under the hood), I find this quiz much more effective.

    1. 7

      Number 2 claims everything is correct, depends on if you’re talking about a Strictly conforming program or not:

      A strictly conforming program shall use only those features of the language and library specified in this International Standard.2) It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and shall not exceed any minimum implementation limit.

      In general, I think this post is kind of useless. For any interesting program I don’t know anyone that knows the entire thing. should we say we don’t know any interesting language? No, that simply becomes a useless way to talk.

      1. 5

        I don’t think the post is useless, it does serve to instruct about a bunch of nuances in C. But I agree that setting the bar for knowing a language at knowing literally every aspect and corner case imaginable is a tad ridiculous.

        1. 11

          That’s fair. I’m just disagreeing with the tone of the article, I suppose. Every language have nuances. One thing you don’t hear people praising is that C has a standard in the first place. What does it mean for Ruby to have nuance? Is it part of the language or a bug etc?

          It’s telling that we can actually have the conversation about these dark corners of C because we have a source of truth to ask.

          1. 2

            Excellent point. We still get implementation differences in compilers though, which is a mixed deal, sometimes good sometimes bad. Regardless the standard is a wonderful thing and I love being able to reference it.

            Tone-wise, the article definitely felt elitist. Which is ironic because the author accomplished that in an article titled “I Do Not Know C.”

          2. 6

            I thought the 2nd line expressed it pretty well: “I want to show that the dark corners of C are much closer than it seems”. What the author didn’t get to is that once you have a healthy respect for the compiler’s behavior you can protect yourself somewhat. Using a compiler with good error messages, telling it to error on most everything [1], disabling optimizations, and checking in valgrind will in combination take you a fair distance away from your squishy human fallibilities. Better yet you can know what you’re signing up for when you write C and better weigh your alternatives.

            1. For clang something like: -std=c99 -O0 -Weverything -Werror -pedantic -ftrapv
            1. 6

              Indeed, though you should prefer -Wall -Werror -Wextra, as -Weverything means literally everything, even stuff still in development. It’s explained quite thoroughly by a clang developer in this stack overflow answer.