Mail Archives: djgpp/2002/04/06/09:01:04
I have a structure that is declared something like this:
struct kSemaphore {
struct kMutex lock;
int count;
kThread* waiters;
};
and i want to be able to initialize it using the C structure constructor
feature:
mySem=(struct kSemaphore){ ... }
As stated in the GCC extensions, i expect this operation to wipe the memory
used by mySem before starting to do specific initialisation, so if i don't put
anything between the brackets, mySem should be all zeroes, right ?
As i'm a lazy coder, i do not feel the need to declare the content of the
'lock' component and only want to give a value to 'count', other fields can
remain zeroes, that's ok for me, so i write
mySem=(struct kSemaphore){count:1};
With gcc 2.7.2.1, this was working pretty well, but gcc 2.9.5.2 seems to
"forget" to write the 1, and i just get a all-zeroes structure once again !?
Note that i can get things working again by filling the whole structure, but i
don't see any reason why i *have* to do so ...
As i have wi(l)dely used that gcc feature in my code (clicker.sourceforge.net),
i would greatly appreciate if i hadn't to change it everywhere ...
Thanks in advance.
Pype (Sylvain Martin)
Happy DjGpp user since 1997
--
May the Source be with You
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
- Raw text -