News for hackers. Stuff that matters.
Re:Type-erased generic functions for C: A modest non-proposal by dundarious on Thursday October 03, 2024 @11:29AM (#41731679)
There are pretty fundamental differences in key areas, like zero initialization of a struct or array (`{0}` vs `{}`). Use the C way in C++ and you only 0 the first element or member. Use the C++ way in C and you don't 0 anything.

IMO there's no point even attempting a blind recompile of C as C++. A transpiler tool would be needed.

Re:Type-erased generic functions for C: A modest non-proposal by plorkyeran on Thursday October 03, 2024 @03:47PM (#41734232)
`int array[100] = {0};` results in an array with 100 zeroes in both C and C++. In C if there are too few values the remaining ones are initialized following the same rules as for static variables, and in C++ they're initialized using value initialization. For all types supported by C these have the same result.