Live data from Hacker News

Learn C in Y Minutes

learnxinyminutes.com

61–70 of 81 posts

Re: Learn C in Y Minutes

#62

My takeaway from this thread is that C programmers are completely insufferable.

You haven't been in many programming language discussion threads have you? ;)

IME C coders are a fairly relaxed bunch on average, definitely more relaxed than some of the younger and more "radical" language communities in C's neighborhood.

Re: Learn C in Y Minutes

#63

This guide recommends Learn C The Hard Way by Zed Shaw as further reading, but the ##C Freenode Channel specifically recommends avoiding it[1]. Can anyone tell me why this book is so contentious? [1] http://www.iso-9899.info/wiki/Books

http://www.iso-9899.info/wiki/Main_Page#Stuff_that_should_be...

Re: Learn C in Y Minutes

#64

Earlier quoted context omitted.

Little reason to not use at least -std=c11 these days

Linux is C99, most microcontrollers use C99 or even C89. It would be nice to get the new features, but it's not always possible.

> most microcontrollers use C99 or even C89

Most microcontrollers are ARM Cortex-M and are programmed with a recent GCC toolchain

Re: Learn C in Y Minutes

#66
post #42
post #39

Earlier quoted context omitted.

For someone planning on learning C in the next couple of months (through K&R), do you have any advice on where to learn best modern practices afterwards?

Unfortunately not, and I see it as a big downside of C where you can only learn about important corner cases with your own bitter experience, direct instruction. Advanced C usage remaining a black magic is not strength, it's weakness. This assures that attackers will always have a significantly stronger upper hand against industry's salaryman developers.

"Advanced C usage" can you explain this, please? What in C is so "advanced" that it's more black magic than C++ or Rust or any other high level language?

With C, what you see is what you get. I don't see how that can possibly be black magic.

Re: Learn C in Y Minutes

#68

Oh man, multiple declaration on the single of code is nasty. Passing this kind of advice causes the beginners to develop bad habits. At least these are not uninitialised variables. // Shorthands for multiple declarations: int i1 = 1, i2 = 2; float f1 = 1.0, f2 = 2.0; int b, c; b = c = 0; Edited:.. After 1hr of posting my original comment, I noticed that there many opinions here. I should have added why I think this i…

This is also bad advice for C: void function_1(); Most people coming from other languages (like C++) will probably think that this is identical with "void function_1(void)", but without the explicit void argument list, the compiler will not warn if the function is accidentally called with parameters.

This isn't the case nowadays.

Re: Learn C in Y Minutes

#69
post #68

Earlier quoted context omitted.

This is also bad advice for C: void function_1(); Most people coming from other languages (like C++) will probably think that this is identical with "void function_1(void)", but without the explicit void argument list, the compiler will not warn if the function is accidentally called with parameters.

This isn't the case nowadays.

Huh? Of course it is:

https://godbolt.org/z/8qYeK89rh

It's only an error in C++, but not in C, and the warning for this isn't included in the usual "-Wall -Wextra" set.

Re: Learn C in Y Minutes

#70
post #66
post #42

Earlier quoted context omitted.

Unfortunately not, and I see it as a big downside of C where you can only learn about important corner cases with your own bitter experience, direct instruction. Advanced C usage remaining a black magic is not strength, it's weakness. This assures that attackers will always have a significantly stronger upper hand against industry's salaryman developers.

"Advanced C usage" can you explain this, please? What in C is so "advanced" that it's more black magic than C++ or Rust or any other high level language? With C, what you see is what you get. I don't see how that can possibly be black magic.

The problem is that you don't see that much.

Compiler these days optimise the code beyond human comprehension. Memory management libs, and what hardware does with your physical memory layout is inscrutable.

Register level vulnerabilities are very much black magic for anybody, but silicon maker itself.

Memory management libs used by any big C program add to complexity.

Fancy runtime pointer, and ROP sanitation libs fix some types of vulnerabilities, and add another.

And so, and so, and so.

I am a big proponent of C, but will not hide that C needs substantial education beyond just programming to use properly, and safely.

Post reply on HN