3 ms·
This is a very strange "getting started" guide to C, and I'm not sure who the intended audience could possibly be. The tone at the start really does seem to be
by opheliate 6y ago
This is a very strange "getting started" guide to C, and I'm not sure who the intended audience could possibly be.
The tone at the start really does seem to be aimed at "absolute beginners" ("[...] programs must be written in a very strict way. Miss a comma and the program will stop working"), but then it quickly gets into the weeds without much explanation.
I'm trying to imagine an beginner reading this: The first thing we're told to do is "Installation", that makes sense. Then the first line says "The Apple provided C compiler is the LLVM clang compiler". But what's a compiler? How does that help me learn C? The tutorial hasn't even indicated that C is a compiled language, or what a compiler does at this point, and it doesn't elaborate on this throughout.
We go on to a hello world example, and we're told to type in some code ("Remember: programming languages are very strict, so type it exactly"), and then we're given an explanation of what it's doing: Great! I can't wait to learn what this means. But the explanation uses terms that a beginner would not be familiar with: The very first line of the explanation is "the first line loads the stdio.h function library, which provides the printf() function, used to write a message on the terminal". What's a function? What's a library? Obviously these things are trivial to anyone with programming experience, but for an absolute beginner, these terms don't yet have an intuitive meaning, and they're never fully explained in the article.
We compile that program (again, never being told what compilation is or why it's necessary), and then we're suddenly thrust into writing a GTK+ program. We haven't covered the absolute basics like types, pointers, etc, and yet we're given a huge chunk of (reasonably complex) code with no explanation, and just told to "read the code bottom to top" as an "additional hint".
I think a much better title for this would be "getting started with C tooling", but even then, the article does a very poor job of explaining why such tooling is even necessary.
- tragomaskhalos 6y agoWrt "the first line loads the stdio.h function library, which provides the printf() function", you're right, "loading a library" is not clear and, what's worse, is actively misleading as actually we're just telling the compiler that there is a function somewhere called printf that will get "loaded" (linked) later on. I remember that this was one of the things that confused me most about C when I learned it.
- tsjq 6y ago>that this was one of the things that confused me most about C when I learned it. absolutely same, me too. and, there was no good websites / videos on the web back then.
- avar 6y agoWe're really just telling the compiler to find a file called stdio.h and act as though its contents were included at that part in our program. Whether the full function is there or linked later is a matter of implementation (some headers have full functions, typically trivial "inline" functions). I can't remember what the standard says via the stdlib, but in general a library you load later on may not have all/some of those functions, but as long as you didn't use them you'll be fine (just as with a redundant forward declaration you yourself did). And finally the whole "linking" part of C is mostly just a widespread convention, not something that the standard really dictates. See section 6.2.2 [1] for the brief words on it mainly to do with "static"/"extern". But the whole "compile" -> "link" (to some existing .so/.a) -> "program" is all implementation defined. 1. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
- pjc50 6y agoYes, one of the confusing things for C newbies is the difference between "works this way on almost all implementations you are likely to encounter" and "actually part of the language". Both provide great opportunities for either the compiler or stackexchange answerers to make the newbie feel inadequate.
- 7thaccount 6y agoMaybe they meant an absolute beginner to C and not programming in general.
- opheliate 6y agoI definitely agree that's possible, but then they go over what a terminal is and what the "ls" command means, and how case-sensitivity and using commas in the correct places are important when programming, which strike me as things which would be assumed knowledge if the audience were expected to have any programming experience.
- 7thaccount 6y agoGood point, although a lot of programmers now use an IDE for everything, so they may have no working knowledge of the command line (or a very limited knowledge).
- mrtranscendence 6y agoI'm a beginner to C and not programming in general, but even I'd struggle to get some actionable knowledge out of skipping from "hello world" to "basic GTK application". This tells me basically nothing about how C works or how to write programs with it.
- tsegratis 6y agoReminds me exactly of my attempt at C tutorial: 1. Aim for newbies. Vastly under estimate the amount of explaining that must entail 2. Peter out somewhere between the first and second real code example