Live data from Hacker News

Learn C in Y Minutes

learnxinyminutes.com

41–50 of 81 posts

Re: Learn C in Y Minutes

#42
post #39
post #37

C is easy to learn, but very hard to master. Having self learned C devs do a big, complex program is an invitation for security vulnerabilities. Most of the time people find themselves fighting against the language, and struggling to have the program simply not to crash. If you see that, you start to think how much those guys would have time left to ensure anything like input sanitation, or code hardening in general.

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.

Re: Learn C in Y Minutes

#43

Earlier quoted context omitted.

> More difficult to read Subjective, and I do not find it more difficult to read. On the contrary, I often find shorter and denser expressions (especially around obligatory fluff that doesn't actually do much) to improve readability and make it easier to focus on the interesting part. > more difficult to edit Subjective, and I do not find it more difficult to edit. In general, as long as you're not using a magnetized…

> with one instruction per line I shouldn't be surprised, of course you're also the kind of person who writes terribly long lines of code. We have ultra-wide screens nowadays, better put them to good use. Anyways, you might think you're making a point by repeating "it's all opinions", but that doesn't mean your single opinion is equal to everyone else. And on the subject of one vs multiple declarations, you're overwh…

For personal project my hard limit is 80 cols. For work stuff, mandated by employer, we do something like 120 cols with clang-format. Four or five columns of code side by side, so I can see hundreds of lines of code at once. I still prefer not to waste too much vertical space on fluff.

It doesn't sound like you understand the difference between block structured code with a function call syntax and assembly. Thanks for the attempted ad hominem btw ;-)

> Anyways, you might think you're making a point by repeating "it's all opinions anyways", but that doesn't mean your single opinion is equal to everyone else.

You keep missing the point. Did I say "that's just nasty and bad habits" about your preferred style? Nope!

All I'm saying is that it'd be nice if people stopped presenting their preference as objectively good style and telling that everything else is nasty and wrong. We don't need to share the same preferred color either.

The first comment in this thread would've been a lot more palatable if it just said "I don't like this style." That would also give the comment the right weight: it is just an opinion after all.

I don't think popularity of opinion should matter for discourse. Of course I know I'm in the minority, and that's why I think it's all that much more important to state my opinion. Or do you want to live in an echo chamber where only the popular opinion gets said and everything else is painted nasty and wrong and downvoted to hell? Well, that is pretty much what HN is today. I hope you're not contributing to that.

Re: Learn C in Y Minutes

#44
The core language is something a person might plausibly learn in Y minutes. Getting any useful work done almost invariably requires learning a lot about the environment and system your code is running in. The idioms of the Windows filesystem stack and most Linux userland code are radically different.

Being able to write code for one will not confer immediate productivity in the other.

Re: Learn C in Y Minutes

#45
post #40
post #18

> Ah, C. Still the language of modern high-performance computing. Yet its major compilers are written in C++ nowadays, and C++ is the main language for GPGPU computing, including the memory model used by NVidia on their cards. I suggest some benchmarks updates to the author.

CUDA kernels look very much like C, you cannot use the STL and a bunch of other things. For practical purposes, it is C.

To be fair, C++ just brings over templated wrappers around battle-tested C CUDA libraries like cuDNN, cuBLAS, etc.

Re: Learn C in Y Minutes

#46
post #39
post #37

C is easy to learn, but very hard to master. Having self learned C devs do a big, complex program is an invitation for security vulnerabilities. Most of the time people find themselves fighting against the language, and struggling to have the program simply not to crash. If you see that, you start to think how much those guys would have time left to ensure anything like input sanitation, or code hardening in general.

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?

I like Effective C: An Introduction to Professional C Programming https://nostarch.com/Effective_C but I would since I wrote it.

Re: Learn C in Y Minutes

#47
post #37

C is easy to learn, but very hard to master. Having self learned C devs do a big, complex program is an invitation for security vulnerabilities. Most of the time people find themselves fighting against the language, and struggling to have the program simply not to crash. If you see that, you start to think how much those guys would have time left to ensure anything like input sanitation, or code hardening in general.

Nowadays it's more like:

>Most of the time people find themselves fighting against the language, and struggling to have the program simply to ...

compile.

Re: Learn C in Y Minutes

#48

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

The one thing that is hard to tolerate in this thread is the negative comment that makes sweeping generalizations about other people based on their choice of programming language.

Re: Learn C in Y Minutes

#49

As a web developer, who mostly spends time with Go and Python, is there any benefits of learning C?

Writing correct C is REALLY hard and slow (strings, manual memory management, concurrency pitfalls). So the investment is not paying off unless you are writing highly performance critical backend services. What can pay-off is learning to read C. Node.js, Firefox, Postgres, Linux are all written in C/C++ so if you ever want to really understand what's going on or have to debug a nasty bug, then you will need to be abl…

> So the investment is not paying off unless you are writing highly performance critical backend services.

You took it too far. C opens the door for today's embedded, like, you know, blinking an LED with some microcontroller.

Re: Learn C in Y Minutes

#50
post #40
post #18

> Ah, C. Still the language of modern high-performance computing. Yet its major compilers are written in C++ nowadays, and C++ is the main language for GPGPU computing, including the memory model used by NVidia on their cards. I suggest some benchmarks updates to the author.

CUDA kernels look very much like C, you cannot use the STL and a bunch of other things. For practical purposes, it is C.

CUDA has stopped being C in version 3.0, update yourself.
Post reply on HN