Initializing Vars in non-OS C systems

knudsen at ihnss.UUCP knudsen at ihnss.UUCP
Sat Jul 23 03:31:38 AEST 1983


I write C code for 8086 systems with the .text and .data (constants
of course) in ROM and the .bss in RAM.
It has been my understanidng that our BTL C compiler (basic16)
will initalize variables if & only if you say so in the declarations.
There are two kinds: globals (declared outside any {}) that are
explicitly assigned to .bss addresses and known by name to
assemblers, loaders, linkers, and debuggers.  The other kind,
declared inside a procedure (inlucding main()), are just stack-frame
and can't be traced.  However, these get initialized (if you assk for it)
on every call.  I don't know whether globals can be init'ed or not;
I always do these with code statements anyway.

Question: does init'ing vars in declarations buy you anything in
space or speed over doing it by actual statements in the body?
	mike k



More information about the Comp.lang.c mailing list