Live data from Hacker News

Effective C: An Introduction to Professional C Programming

nostarch.com

101–109 of 109 posts

Re: Effective C: An Introduction to Professional C Programming

#101
post #100
post #88

Earlier quoted context omitted.

From a C-veteran perspective, what do you think about type safe (e.g. dependent types such in ATS, or F*/KreMLin, or other DSLs) languages that compile to C, or a subset of C? How could one get the safety promises that are observed in Rust in C? Thanks!

I'm not the OP you're asking, I'll provide my own answer to the latter question though. C is a language that doesn't come with many guarantees. I personally like to think of C as a 'higher-level assembler', targeting a virtual machine. I've been led to believe that this figurative description of the language was more common in the past than it is today. I find it a helpful description since it offers an explanation f…

I see. Thank you very much for your explanation.

I always thought that after so many years, there must be a testing framework, development tools and methodology to give a C developer the safety that his problem requires. What do people use when they are programming critical systems e.g. defense,health,flight control, etc. Problems like Heartbleed et al are not something that can be ignored in the industry.

That is why I wondered about advanced tools I heard about e.g. ATS, Compcert, and so on. As I understand, the model that is used in Rust comes with limitations in regard to program design.

Re: Effective C: An Introduction to Professional C Programming

#102
post #82

I started learning C at the start of this year by going through K&R and Understanding and Using C Pointers. I will likely pick this is up, it looks good and I really like No Starch Press books. Does anyone have pointers on where to start with actual embedded programming? I have a couple Arduinos and RPis laying around, but I'm wondering if there are more 'real' ways to do it.

Much of my job is embedded engineering, to establish a bit of credulity for the following recommendations. My employer is partial to ST Micro and Renesas, so keep that in mind. Others may suggest Silicon Labs, Microchip, or Texas Instruments. This will also be biased by my own education and work experience (e.g. no robotics, more sensors/lights stuff). I'd recommend getting a dev kit like the STM32F4DISCOVERY ( https…

AFAIK TI released new MSP430 chips in 2019. I don't think this is "dated".

Re: Effective C: An Introduction to Professional C Programming

#103
post #102
post #82

Earlier quoted context omitted.

Much of my job is embedded engineering, to establish a bit of credulity for the following recommendations. My employer is partial to ST Micro and Renesas, so keep that in mind. Others may suggest Silicon Labs, Microchip, or Texas Instruments. This will also be biased by my own education and work experience (e.g. no robotics, more sensors/lights stuff). I'd recommend getting a dev kit like the STM32F4DISCOVERY ( https…

AFAIK TI released new MSP430 chips in 2019. I don't think this is "dated".

Thanks for updating me on that! Guess there's that bias in my experience showing up.

Re: Effective C: An Introduction to Professional C Programming

#104
Obviously, there's the iconic K&R, which some people don't like for its terseness. I loved it - pure and to the point. However, the second book that made a huge impact on me was "Reusable Data Structures For C" by Roger Sessions. If you internalize these two books you'll be a highly competent C programmer. https://www.amazon.com/Reusable-Data-Structures-Prentice-hal...

Re: Effective C: An Introduction to Professional C Programming

#105

Earlier quoted context omitted.

Not to be rude to the author but what makes him the best person to be writing modern C books?

So it's hard to say that I'm the best person to write a modern C book. A slightly lower bar might be, am I the best person who has actually written a modern C Book? Resume-wise, I've been writing C code since 1985, and I've been an expert on the C Standards Committee (WG14) since 2004. I've written two prior books on C Programming including "Secure Coding in C and C++" and "The CERT C Coding Standard". I also teach S…

I probably could have chose a different wording, but everything you've just said is exactly why I suggested it; C isn't a language just anyone should be writing about, especially when it comes to security

Re: Effective C: An Introduction to Professional C Programming

#106
post #63

Earlier quoted context omitted.

So it's hard to say that I'm the best person to write a modern C book. A slightly lower bar might be, am I the best person who has actually written a modern C Book? Resume-wise, I've been writing C code since 1985, and I've been an expert on the C Standards Committee (WG14) since 2004. I've written two prior books on C Programming including "Secure Coding in C and C++" and "The CERT C Coding Standard". I also teach S…

If I buy a copy of your book, will you abuse your position to get constexpr into C? It would be a big improvement over complex macro magic. I'll buy an extra copy if you can get 'defer' in there too! Those two features would really be the bee's knees :)

This is an interesting coincidence, because I just started drafting a 'defer' paper. In general, this is not an abuse of my position. I would be happy to collaborate with you (or anyone else in the community) to develop papers and champion them to the committee. They would have to be sensible ideas, which both of yours are too.

Re: Effective C: An Introduction to Professional C Programming

#107
post #95

Earlier quoted context omitted.

So it's hard to say that I'm the best person to write a modern C book. A slightly lower bar might be, am I the best person who has actually written a modern C Book? Resume-wise, I've been writing C code since 1985, and I've been an expert on the C Standards Committee (WG14) since 2004. I've written two prior books on C Programming including "Secure Coding in C and C++" and "The CERT C Coding Standard". I also teach S…

Oh, a standards committee member! We have requests... Now that C allows mixing variable declarations in with statements, it becomes annoying that variable declarations can not have labels. This hits particularly hard with the switch/case, but can also apply with ordinary named labels. The syntax to work around this defect is ugly. The gcc extension for case ranges is really valuable. Setting the sign bit via a cast s…

So there are many ideas here. I commented separately that I would be happy to help members of the community develop quality proposals and champion these to the committee. You can look here http://www.open-std.org/jtc1/sc22/wg14/www/wg14_document_log... to see what proposals normally look like. You would have to develop your suggestions further before they would have a reasonable chance of being adopted.

Re: Effective C: An Introduction to Professional C Programming

#108
post #73

Earlier quoted context omitted.

the only thing C missed was a stdnet lib, with things like starting a network daemon and http parsers. oh and a decent list stdlib that everyone could agree on and build the rest on top. had that happened a while ago, we would never have seen php et al.

Actually, you should research about the story why php was created... it was primarily envisioned as a templating language and the creator wanted people to use c/c++ for business logic etc, however people didn't do that because it was easier with php. There is absolutely no reason why a website should be build with c, sry... Edit: link to rasmus lerdorf on 25 years php: https://m.youtube.com/watch?v=wCZ5TJCBWMg

php was never anything serious until it lived on top apache.

Re: Effective C: An Introduction to Professional C Programming

#109
post #63

Earlier quoted context omitted.

If I buy a copy of your book, will you abuse your position to get constexpr into C? It would be a big improvement over complex macro magic. I'll buy an extra copy if you can get 'defer' in there too! Those two features would really be the bee's knees :)

This is an interesting coincidence, because I just started drafting a 'defer' paper. In general, this is not an abuse of my position. I would be happy to collaborate with you (or anyone else in the community) to develop papers and champion them to the committee. They would have to be sensible ideas, which both of yours are too.

That's awesome!!! I'm actually really interested in the semantics of how a defer{} statement might work in C. If you have any kind of a draft or anything, I'd get a kick out of reading over it.

Re: developing a paper for constexpr, that's an interesting idea. I hadn't really thought about writing one up myself but it'd be an interesting thing to try out. Can you recommend a good example proposal that I could read? Shoot me an email at nicholas dot clark on the gmail if you ever see this.

Post reply on HN