Initialization of .BSS question.

Joe Huffman joe at proto.COM
Sun Jul 1 01:42:53 AEST 1990


In article <1990Jun29.014319.11970 at virtech.uucp>, cpcahil at virtech.uucp (Conor P. Cahill) writes:
> In article <1319 at proto.COM> joe at proto.COM (Joe Huffman) writes:
> >I am porting the runtime library from a MSDOS compiler to UNIX.  Under
> 
> 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)).

[FLAME ON!]
Was I so unclear on this??  Nearly all the respondents seemed to
misunderstand me.  I am porting (part of) the compiler!!  The setup code that 
calls main is what I was concerned about.  This is MY code that calls main() 
(among other things).  I know that .BSS MUST be set to zero (by somebodies 
code, OS or compiler) or else I wouldn't be worrying about it or have been 
assigned this task.  My concern was whether all UNIX's could be depended on 
for this.  Not whether all 'C' compilers could be counted on for this in your 
application code.  I am aware of that and that is why I was concerned, I did 
not want to ship a 'VERY BROKEN' C/C++ compiler.
[FLAME OFF!]

Thank you for your responses.  There were a couple of people who understood
my question and answered it adequately.

Sorry (well, some anyway) for spouting off.  Next time (coming up soon) I will
be a bit more explicit about what I'm asking about.


-- 
joe at proto.com
uunet!proto!joe
FAX: 208-263-8772



More information about the Comp.unix.wizards mailing list