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).
malloc
...
Jan 15, 2013 at 6:41
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:
void func()
hasn't specified its arguments? How can this be used practically?
Oct 27, 2012 at 10:30
void
as the parameter in that case. :-)
Jan 15, 2013 at 17:42