www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/08/12:55:50

Date: Tue, 8 Jul 1997 12:54:58 -0400 (EDT)
From: "Art S. Kagel" <kagel AT ns1 DOT bloomberg DOT com>
To: George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Cc: djgpp AT delorie DOT com
Subject: Re: why is this giveing me a parse error?
In-Reply-To: <5pjtjp$e36@news.ox.ac.uk>
Message-Id: <Pine.D-G.3.91.970708114903.29797B-100000@dg1>
Mime-Version: 1.0

On 4 Jul 1997, George Foot wrote:

> levity AT minn DOT net wrote:
> : every time I try to compile this program with djgpp it gives me a parse
> : error.  Note that the code I am including is scaled down in an atmpt to
> : isolate the problem.
> 
> In C you are not allowed to define variables within a block; your
> definition of `bmh' must come before any code in the block, i.e. before
> the fopen call. C++ does allow you to define variables almost anywhere
> though.

Wrong!  ANSI C does indeed allow one to define variables at the beginning 
of any block!  C++ further adds the ability to define variables anywhere 
within a block.  Please do not post mis-information.

I do not clearly remember the original posting, but, I think that 
'levity' was trying to define a variable in the statement of a for or 
while loop.  If that was it, then since the statement itself is not 
within the block defined by its braces this is illegal in a C program.

Art S. Kagel, kagel AT bloomberg DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019