Live data from Hacker News

Getting started with C

not.cafe

21–30 of 106 posts

Re: Getting started with C

#21
post #7
post #3

Introducing newbies to GTK is a great way to show them a lot of code they don't understand, will take a while to understand, and will break in non-obvious ways.

..and that uses non-standard concepts like GObject. Win32 examples would have been peak hilarity. More seriously, I see where the author is coming from, but even historically, GUI code has always been a massive pain in C.

Telling people that the default string type is LPTCSTR and the default integer type is HRESULT would be top trolling.

Re: Getting started with C

#23
post #6

Earlier quoted context omitted.

Just read K&R for 10 minutes.

:-) I wish people would stop recommending this outdated book, along with a few other default goto books (say, the Dragon book). Its super optimistic approach is more about the language K&R wanted C to be than the real thing.

Maybe there aren't any good alternatives to "read this go to book as the first book on the topic". Prove me wrong. (Please)

Re: Getting started with C

#24
post #18
post #11

Earlier quoted context omitted.

It kind of depends on what you need out of C. The only real reasons left to use C in the wild are: * Legacy code * Embedded (including drivers, bare metal etc.) * Portability, FFI, etc. Performance used to be another major reason, but in $CURRENT_YEAR, if that's your goal, C++ and Rust are just as performant and there's very little reason not to opt into them. The other major reason to learn C is that it's a great "h…

I would still suggest that people learn C before attempting C++; while someone with C# or Java experience could probably do well in a "modern C++" codebase, as soon as they go off-piste into memory allocation and pointers they're in for surprises. (Is there anyone who learns Rust who isn't already a proficient but frustrated C++ programmer?)

Completely agree, that was part of the point I was making, for example, I doubt I would ever have understood RAII had I never seen malloc.

Parent was suggesting they are already a programmer, so I assumed they already had at least a grasp of how pointers and manual memory management work. If one happens to lack such knowledge, I agree learning C is an excellent first step.

Re: Getting started with C

#26
post #6

Earlier quoted context omitted.

Just read K&R for 10 minutes.

:-) I wish people would stop recommending this outdated book, along with a few other default goto books (say, the Dragon book). Its super optimistic approach is more about the language K&R wanted C to be than the real thing.

The book is fine. It is way better to start off by sorting words from stdin with K&R than to follow a tutorial to do a GUI window.

Re: Getting started with C

#28
This strikes me as very out of touch with reality. You can't go directly from hello world to 100+ lines of 3rd-party code that uses pointers all over the place and just brush it off with "don't worry about the complexity".
Post reply on HN