What are the differences between pure C and C in C++?
What are some details about 'Clean C' on which Lua is based? What are those features?
What are the differences between pure C and C in C++?
What are some details about 'Clean C' on which Lua is based? What are those features?
Clean C is a term coined in Harbison & Steele book (C: A Reference Manual, Prentice Hall). A program is said to be written in Clean C if it can be compiled by a standard C compiler and a standard C++ compiler; and its execution would not produce different observable behavior from the two compilers (the issues of optimizations being irrelevant).
One that strikes me as being the most obvious is that in C++, you have to cast the return value of malloc. Also structs are automatically typedefed in C++.
Always use a C compiler for C code, not C++. C++ isn't perfectly compatible with C.
A few others differences may be: