Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!ut-sally!utah-cs!utah-gr!uplherc!sp7040!obie!wes From: wes@obie.UUCP (Barnacle Wes) Newsgroups: comp.lang.c Subject: Re: Caution for those considering MSC 5.0 Message-ID: <66@obie.UUCP> Date: 21 Feb 88 20:15:12 GMT References: <11754@brl-adm.ARPA> Organization: UinTech, Layton, UT Lines: 41 Summary: Problem is with Turbo, not MSC In article <11754@brl-adm.ARPA>, PEPRBV%CFAAMP.BITNET@husc6.harvard.EDU (Bob Babcock) writes: > The manual seems to indicate that only initialized global > data will go here This is correct. This is also as it should be. > but isn't all global data implicitly > initialized to zero if not otherwise specified? No, as a matter of fact, it ISN'T supposed to be zeroed, it's supposed to be left as it was! MSC isn't wrong here, your code is wrong because it was written to work with Turbo C, which is wrong. The MSC compiler is the same compiler as Microsoft's Xenix compiler; it generates three types of segments: text, data, and bss. Text segments contain executable program text, they are executable but not writable on protected systems. The filler for the text segments are, of course, stored in the executable file. Data segments contain initialized variables, they are non-executable, readable, and writable. The values for the data segments are stored in the executable file, similar to the text segments. BSS (Block Starting with Symbol) segments are for pre-allocated, uninitialized data items that are NOT stack based. In C, this means all STATIC variables (of which globals are a sub-set) that are not initialized. The stack segment is basically just a special bss segment. This is the way C compilers are supposed to generate code. As usual, Borland made good ol' Turbo C do it wrong, and if you work with TC at any depth at all, it will screw you every time! (IMHO) your best bet is to do what I did: pitch Turbo C in the garbage, either cry or rage for a FEW minutes over what a waste of money it was, and buy Quick C. Of course, since you have MSC 5.0, you *alreay have* Quick C. Lucky you. -- /\ - "Against Stupidity, - {backbones}! /\/\ . /\ - The Gods Themselves - utah-cs!utah-gr! / \/ \/\/ \ - Contend in Vain." - uplherc!sp7040! / U i n T e c h \ - Schiller - obie!wes