Live data from Hacker News

Essential C

cslibrary.stanford.edu

21–30 of 57 posts

Re: Essential C

#21
post #20

Earlier quoted context omitted.

C99 object literals are also fantastic. I feel very constrained when I have to use strict C89. Meanwhile, in terms of C11 [update: actually also from C99] I actually wrote a function with a signature like void func(int arg[static 3]); but later removed it because (a) the generated code was the same, and (b) rather than increasing clarity and self-documentation, it caused confusion; even when you're familiar with the…

I do love object literals. The 'static' keyword for array parameters actually dates to the C99 standard.

You're 100% correct, my mistake.

Re: Essential C

#22
post #17

Oh, memories. I took CS107 in 1996, which was apparently the date this handout was written. Nick was my academic advisor, and his CS108 (which was C++ at the time) was one of my favorite courses of all time. Bunny World... Maybe I'm just a grumpy old programmer, but I feel like kids these days are missing out on something important by learning to program in a language that doesn't require them to truly grok memory ma…

As an undergraduate senior in the CS program at the University of Washington, I can definitely attest to memory management giving the majority of people a really hard time in our required C course. I've only talked to one other person in my cohort that likes programming in C, and unsurprisingly they don't have any trouble with the finer points of it at all.

Re: Essential C

#23

I recently started a graduate course that originally required C++. My only exposure to C++ basically went through the fundamentals of the C part without getting to any of the ++. Is there something similar to this for C++? I understand that C++ is a much larger language and I'm definitely not looking for something comprehensive, more of a solid overview of a workable subset of the language. Enough to be productive, p…

"Thinking in C++" by Bruce Eckel "Effective C++" by Scott Myers

Isn't Thinking in C++ a little on the outdated side, by this point?

Re: Essential C

#24
post #17

Oh, memories. I took CS107 in 1996, which was apparently the date this handout was written. Nick was my academic advisor, and his CS108 (which was C++ at the time) was one of my favorite courses of all time. Bunny World... Maybe I'm just a grumpy old programmer, but I feel like kids these days are missing out on something important by learning to program in a language that doesn't require them to truly grok memory ma…

Most of my classes were taught in Java, but I took care to also learn and do a lot of work in C++. I've also played around with disassembling various binaries (especially code actually written in assembly, like DOS games). Teaching myself to manually track the state of the stack, and see how it was used in function calls, was eye-opening in a way similar to learning manual memory management.

Re: Essential C

#26
post #17

Oh, memories. I took CS107 in 1996, which was apparently the date this handout was written. Nick was my academic advisor, and his CS108 (which was C++ at the time) was one of my favorite courses of all time. Bunny World... Maybe I'm just a grumpy old programmer, but I feel like kids these days are missing out on something important by learning to program in a language that doesn't require them to truly grok memory ma…

I actually took CS107 in 2012 with Jerry Cain, and we still used this handout as a reference guide.

Re: Essential C

#27

Earlier quoted context omitted.

I don't know if I would count any part of C11 as "essential", particularly given its still-spotty implementation coverage.

A lot of code is still written in C89 for maximum portability, and I regularly do that. The only thing I really miss from C99 is the mixed declarations and code, but you can instead use nested scopes or just move the declarations up to the top.

What portability do you need, specifically, beyond C99?

Re: Essential C

#28
post #2

Essential C doesn't mention a standard but it says Copyright 1996-2003 . I'm going guess it hasn't been updated for C11. Modern C [1] covers C11 and was mentioned before. However, it weighs in at 300 pages rather than Essential C 's 45. [1] http://icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf Actually, reading through Essential C , it hasn't really been updated for C99 since it uses C89 declarations: C takes th…

I don't know if I would count any part of C11 as "essential", particularly given its still-spotty implementation coverage.

You are partly right about the implementation coverage. For a lot of embedded development where you can't cross compile with a modern compiler it's of course an issue. For major desktop and mobile platforms, I don't see an issue. Clang has excellent support for the mandatory parts of C11, it's even the default setting (well GNU C11). Given that one can now configure Clang as the frontend for Visual Studio on Windows, the backwardness of Visual studio in regards to modern C standards is no longer an issue as well.

For essential features, well if one uses C it's usually to have fine-graded control of memory use and allocation patterns. Then C11 _Alignas, and _Alignof are pretty essential. Yes you can do that with platform/compiler specific macros without C11, but it's nice to be able to avoid that.

Re: Essential C

#29
post #7

Any additional recommendations for C tutorials?

I'm not sure of any. I do a bunch of embedded C code. I find a lot of C code tutorials are algorithm / datastructure focused. Which is ok to learn. You should definitely feel confident in implementing data structures / algorithms in C. But I'm not sure of any good tutorials which teach you how to engineer C programs. There is no "one true approach" but you definitely need to take "a" approach to constructing C programs. You need to have really good convention about how to do various things and how to compose your software.

Also C unit testing is often rare. I ended up writing my own framework (which I open sourced, but am neglectful with maintenace) with the idea you can run tests on embedded devices. Meaning it only relies on pretty vanilla C and has no memory allocation.

But, definitely incorporate unit testing in your C coding experience. It will help focus you on not falling for the evils of the language

Re: Essential C

#30

I recently started a graduate course that originally required C++. My only exposure to C++ basically went through the fundamentals of the C part without getting to any of the ++. Is there something similar to this for C++? I understand that C++ is a much larger language and I'm definitely not looking for something comprehensive, more of a solid overview of a workable subset of the language. Enough to be productive, p…

Advanced C++ Programming Styles and Idioms by James O. Coplien

https://www.amazon.com/Advanced-C-Programming-Styles-Idioms/...

Post reply on HN