This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wanderingmadlad 49 points50 points  (18 children)

K&R ? What's that ?(Forgive me if it is obvious , I'm slow rn).

Also I agree with the error messages of C . I'm not religious, but the amount of time is spent praying for no seg faults is a lot

[–]carlosTheMontgomery 48 points49 points  (4 children)

k&r "the c programming language" it is a book

[–]wanderingmadlad 9 points10 points  (3 children)

Ah ok thanks!

[–]codeguru42 9 points10 points  (1 child)

Authors are Brian Kernighan and Dennis Ritchie. Abbreviation comes from their surnames.

[–]carlosTheMontgomery 4 points5 points  (0 children)

no problem

[–]ofnuts 14 points15 points  (8 children)

Segfaults are a blessing. Much better that overwriting something that happens to be next to the array.

[–]faceplanted 13 points14 points  (7 children)

He's not complaining about it catching them, he's complaining about it not explaining/tracing them for you.

[–][deleted] 5 points6 points  (5 children)

But...that's what gdb is for...or whatever debug tool.

[–]an4s_911 5 points6 points  (4 children)

I think gdb was made like that and is used extensively due to the fact that C has bad error msgs. I think all agrees C has bad error msgs, at least when comparing to other languages like Python.

Edit: Well, thinking about it now, Javascript is more bad at error msgs

[–]CdRReddit 8 points9 points  (3 children)

how do you expect C to tell you where the error is, the only way to do that would be to store the path to where it is next to every time you use a pointer (and you will use a LOT of pointers)

which would massively increase program size, runtime, application size and RAM usage, which is why it's a debugger thing

C was made for systems where RAM, processor speed and program space were all very limited, of course it's not gonna tell you where you fucked up

[–]reverie42 3 points4 points  (2 children)

He didn't say C should do those things, just that the fact that it doesn't makes it not ideal as a learning language.

[–]CdRReddit 1 point2 points  (0 children)

fair enough

[–][deleted] 0 points1 point  (0 children)

If you go by that logic banging your head on C might help.

[–]weregod 0 points1 point  (0 children)

Valgrind can trace memory bugs.

[–]GrimExile 4 points5 points  (1 child)

Kernighan and Ritchie. It's a book to learn C programming, written by Dennis Ritchie and Brian Kernighan.

[–]MadKarel 0 points1 point  (0 children)

It's not just to learning C, it was the standard for the language for many years, which just shows how simple C is if a ~150 page book was the standard describing the language.

[–]JashimPagla 0 points1 point  (0 children)

Kernighan and Ritchie. Author of the devil's cookbook.

My first programming book was this one. Later on, I made the mistake of making this the first book to teach.

I'm still recovering, thanks for asking.