lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Joshua Jensen wrote:
[...]
> This will fail:
> 
>     char *buffer = malloc(100);

You can't forward declare non-extern variables:

static int i;
...
static int i = 1; /* fails in C++ */


structs and types now share the same namespace:

struct Fnord { ... };
typedef int Fnord; /* fails in C++ */


'x' literals are now of type char, not int:

assert(sizeof('x') == sizeof(int)); /* fails in C++ */


There's a lot more, mostly due to edge cases being differently weird.
There's a good list here:

http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ 𝕻𝖍'𝖓𝖌𝖑𝖚𝖎 𝖒𝖌𝖑𝖜'𝖓𝖆𝖋𝖍 𝕮𝖙𝖍𝖚𝖑𝖍𝖚 𝕽'𝖑𝖞𝖊𝖍
𝖜𝖌𝖆𝖍'𝖓𝖆𝖌𝖑 𝖋𝖍𝖙𝖆𝖌𝖓.
│

Attachment: signature.asc
Description: OpenPGP digital signature