Xref: utzoo comp.unix.i386:6306 comp.unix.wizards:22682 Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.i386,comp.unix.wizards Subject: Re: Initialization of .BSS question. Keywords: C, C++, Runtime library, Loader, OS Message-ID: <1990Jun29.014319.11970@virtech.uucp> Date: 29 Jun 90 01:43:19 GMT References: <1319@proto.COM> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 23 In article <1319@proto.COM> joe@proto.COM (Joe Huffman) writes: >I am porting the runtime library from a MSDOS compiler to UNIX. Under >SCO UNIX (first target) the .BSS segment is initialized to all 0's by >the OS (at least prior to the application code getting control). Under >MSDOS this was the responsiblity of the startup code. I currently have >it removed from the UNIX version but was a bit concerned that under some >versions of UNIX it may be necessary to include it. As other discussions ANY C compiler, when building an executable for a hosted environment, on any machine under any OS that doesn't initialize all of non-initialized global variables (.BSS) to all 0's is VERY BROKEN. You will not have to add any initialization code to set this stuff to zero. (And should not have to add it to your DOS compiler. (However, you DOS compiler may have this stuff in it's setup code that is called prior to your main() routine, but you should not have to be aware of this mechanism)). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170