Live data from Hacker News

Beej’s Guide to C Programming [pdf]

beej.us

151–160 of 178 posts

Re: Beej’s Guide to C Programming [pdf]

#151

Earlier quoted context omitted.

All of it. C++ is a superset of C.

Others disagree: https://mcla.ug/blog/cpp-is-not-a-superset-of-c.html

Bjarne Stroustrup, C++ creator, disagrees, IIRC. Think I read it on his site.

Edit:

https://www.stroustrup.com/bs_faq.html#C-is-subset

>Please note that "C" in the paragraphs above refers to Classic C and C89. C++ is not a descendant of C99; C++ and C99 are siblings.

Re: Beej’s Guide to C Programming [pdf]

#152
post #142

Earlier quoted context omitted.

There was a thread about that group a few months ago and this post in particular really stuck in my mind: https://news.ycombinator.com/item?id=26127632

That's what I remember from comp.lang.c -- lawyer-ly obsession with ANSI C, rather than C as it's being used. That is an important distinction which I respect, but they should have had some kind of sister forum that's more practical. They denied that hardware exists, etc. Also, obsession with ANSI C, analogous to obsession with POSIX shell, is sort of "middlebrow" in the sense that the people who WRITE the spec need…

[deleted]

Re: Beej’s Guide to C Programming [pdf]

#153
I love C programming. Even though people say it's dangerous and easy to shoot yourself in the foot, It really is the simplest and most elegant way forward. That said, having to invent the wheel yourself so much, it is not as time efficient as some more modern languages.

I liken it to an artisanal craftsman's tool versus a modern multi-tool like a dremel which would be something like python.

Re: Beej’s Guide to C Programming [pdf]

#155
post #120

Earlier quoted context omitted.

Backstory: I started writing this book for novice programmers about 15 years ago. It was going to be a lot shorter. But I became disinterested because: 1. Most beginning programmers don't start with C 2. I wouldn't get a chance to go deep and explore the language. So I shelved it, unfinished. Flash forward to about a year ago... I had flash of inspiration: change the audience to intermediate programmers. Now I could…

Just wanted to say THANK YOU as I read your guide to network programming way back in 2000, over 20 years ago! I was just starting out in C network programming on VxWorks :) Glad to see you're still updating your guides.

Thanks! Makes my day to hear people find the work useful. :)

Re: Beej’s Guide to C Programming [pdf]

#156

I love C programming. Even though people say it's dangerous and easy to shoot yourself in the foot, It really is the simplest and most elegant way forward. That said, having to invent the wheel yourself so much, it is not as time efficient as some more modern languages. I liken it to an artisanal craftsman's tool versus a modern multi-tool like a dremel which would be something like python.

Totally agree - sometimes I solve small problems in C rather than a scripting language. It feels like freedom and the result is so damn fast.

Re: Beej’s Guide to C Programming [pdf]

#157

I stumbled upon this gem a while ago [0] while looking for a decent tutorial and reference to C: Stuff that should be avoided: [...] Beej's Guide to C: http://beej.us/guide/bgc/output/html/singlepage/bgc.html Full of mistakes. [...] Could someone confirm this? I've seen a lot of threads here on HN praising beej's guides so I am somewhat confused. [0] http://www.iso-9899.info/wiki/Main_Page edit: Formatting

On a quick skim of some introductory parts I found: > When you have a variable in C, the value of that variable is in memory somewhere, at some address. Of course. After all, where else would it be? It would be in a register. Of course. Or it would be eliminated by a compiler optimization. Of course. Same error later on: > When you pass a value to a function,a copy of that value gets made in this magical mystery worl…

> Only one sentence of this is relevant for an introductory Hello World chapter: "Basically, if we tried to use printf() without #include , the compiler would have complained to us about it."

Quite the contrary in my opinion. As a beginner I was very frustrated with most approach that say "Just put that thing that is needed and will be explained latter. And it work good job attaboy!"

And maybe 250 pages latter if the author didn't forgot in the meantime you get a one liner mention that link back to the first introduction of the syntax.

At least this guide don't let the reader in the fog wondering.

Re: Beej’s Guide to C Programming [pdf]

#158
post #139

Earlier quoted context omitted.

I’m actually implementing that right now for my own use, as a pre-processor. There is a much more advanced design and implementation at “A defer mechanism for C” (December 2020): https://gustedt.wordpress.com/2020/12/14/a-defer-mechanism-f... For my own purposes, I think I can live without handling stack unwinding so I continue working on my pre-processor. Since the pre-processor is not yet finished, there I use a ve…

For a vector alternative, I find this one easy to read and use : https://github.com/tezc/sc/tree/master/array It is just an array of your type, e.g int *numbers, so you have type info in debugger as well.

No type safety and broken alignment. No thanks.

Re: Beej’s Guide to C Programming [pdf]

#159
post #139

Earlier quoted context omitted.

For a vector alternative, I find this one easy to read and use : https://github.com/tezc/sc/tree/master/array It is just an array of your type, e.g int *numbers, so you have type info in debugger as well.

No type safety and broken alignment. No thanks.

Isn’t it type safe? e.g you can’t add char* to a double array.

What do you mean by broken alignment?

Re: Beej’s Guide to C Programming [pdf]

#160
post #120

Earlier quoted context omitted.

On further observation the git repository of the book [0] seems to be quite active. Maybe this book might be finished after all. [0]: https://github.com/beejjorgensen/bgc

Backstory: I started writing this book for novice programmers about 15 years ago. It was going to be a lot shorter. But I became disinterested because: 1. Most beginning programmers don't start with C 2. I wouldn't get a chance to go deep and explore the language. So I shelved it, unfinished. Flash forward to about a year ago... I had flash of inspiration: change the audience to intermediate programmers. Now I could…

Glad to hear this, thank you!
Post reply on HN