Structure initialization rules question
Raver Dave
dave at ur-helheim.UUCP
Fri May 23 03:07:18 AEST 1986
In article <696 at moscom.UUCP> noemi at moscom.UUCP (Noemi Berry) writes:
>
> Why is it that you can only initialize structures when they are global
> (outside of main() )?
>noemi berry
>{allegra|decvax|seismo}!rochester!moscom!noemi
>"On a souvent besoin de plus petit que soi"
K&R p120 (as in the index):
"An 'external' or 'static' structure can be initialized by...
a list of initializers for the components."
So the 'reason' is most likely that this initialization occurs
at compile time and not at runtime, since the latter could be very
costly.
Raver Dave
More information about the Comp.lang.c
mailing list