News for hackers. Stuff that matters.
Re:Simple Dynamic Strings library for C, compatible with nul... by chrchang523 on Tuesday December 03, 2019 @12:16PM (#21694282)
My preferred approach for handling this type of scenario is to write C code that is valid C++, while adding a bunch of C++-specific mostly-compile-time safety checks which can't be expressed in pure C. It's not perfect, but it has helped me reduce the impact of footguns without sacrificing the interoperability advantages of C.

(And as other commenters have noted, wrapping the char* in a struct addresses the immediate footgun in question.)

There are no comments on this comment yet.