Date: Fri, 14 Mar 1997 09:38:37 -0500 (EST) From: "art s. kagel IFMX x2697" To: John Beppu Cc: djgpp AT delorie DOT com Subject: Re: DJGPP inconsistencies? In-Reply-To: <5g9umf$jaa@news.service.uci.edu> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Actually ANSI "C" permits the declaration of variables at the beginning of any code block, ie after the opening brace ({) and before any executable code. Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com On 13 Mar 1997, John Beppu wrote: > In article <5g9p1b$fac AT netra DOT montana DOT edu>, > Paul Peavyhouse wrote: > > [this didn't work for Paul] > > >DATAFILE *terra; > > > > int main (int c, char **v) > > { > > terra = load_datafile("terra.dat"); > > char *str; > > } > > > > [but this one did work for Paul] > > > > >DATAFILE *terra; > > > > int main (int c, char **v) > > { > > char *str; > > terra = load_datafile("terra.dat"); > > } > > > Maybe you've found another difference between C and C++. In C, > variables need to be declared at the beginning of a function; > with C++, this isn't the case. Did you compile these as C > programs when you really meant to compile them as C++ programs? > What error messages did you receive? > > > > > ...IT WORKS?!?!?! I can live with writing it this way, but I want to > >know why the compiler pukes when I write it the other way. Can any help me > >here? I'd appreciate it! > > [daydreaming] > > (I wish comp.lang.asm.x86 would be liberated... I miss it.) > > > > > -- > beppu AT uci DOT edu ............................................................. >