lua-users home
lua-l archive

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


Hi,

I did run into an OSX bug in the past where it wasn't zero-initialising global
variables:

#include <stdio.h>

int foo;

int main(int argc, char* argv[])
{
   printf("%d\n", foo);
}

This must return '0' (the standard requires it), but the Apple wasn't.
Explicitly initialising 'foo' with 'int foo = 0;' worked, but that shouldn't
be necessary.

This was back in the days of OSX on PowerPC; and I don't know whether the
bug's been fixed or not by now.

Don't you have to declare the variable static? Otherwise I
believe it's ok to leave the value uninitialized (at least in C).

Regards,
Diego.