News for hackers. Stuff that matters.
Re:Modern C by thoquz on Friday September 04, 2020 @03:48AM (#24372705)
Can anyone recommend a book on modern C for embedded?

Architecture which it targets doesn't matter.

I want to see what are best practices, such as what is done in the generic driver's on GitHub by Bosch for their sensors. (Such as the BMP280)

Re:Modern C by mytailorisrich on Friday September 04, 2020 @09:17AM (#24374638)
For best practices you're probably better served by looking at standards and guidelines specific for embedded systems. For example MISRA C. There is also the JPL C Coding Standards, which are based on MISRA and are freely available.
Re:Modern C by ianhowson on Friday September 04, 2020 @12:17PM (#24376301)
MISRA and the JPL standards are required reading if you're doing safety-critical work.

They tend to warp the structure of your software and prevent usage of many useful language features.

If you're not doing safety work, the Linux kernel is a great example of 'nice' modern C.

Re:Modern C by ravingraven on Friday September 04, 2020 @04:00AM (#24372769)
Are you refering to this:

https://github.com/BoschSensortec/BMP280_driver/blob/master/...

...?

Because there is nothing inherently modern about this code, this is how C has been written for decades if not from the very start (I think you will struggle to find patterns in this code that are not covered by KnR).

That being said, there are books that cover relatively new developments in the C language and its ecosystem, such as "21st Centry C" by Ben Klemens (but even this book is something like 5-10 years old).

Re:Modern C by locuscoeruleus on Friday September 04, 2020 @03:53AM (#24372739)
What about Test Driven Development for Embedded C?
Re:Modern C by botto on Friday September 04, 2020 @06:27AM (#24373636)
So there wouldn't be anything specific for embedded, you can apply the same testing practice as other systems where you ensure you abstract out the functions in such a way that the logic can be tested.

The complexity about embedded starts want to incorporate the testing with things like IO, which is more end to end testing rather than TDD.

Re:Modern C by dave84 on Friday September 04, 2020 @07:06AM (#24373858)
That’s the name of a book.