delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/10/06:14:03

Date: Tue, 10 Nov 1998 13:13:13 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Daniel Mironowicz <danielm9 AT polbox DOT com>
cc: DJGPP <djgpp AT delorie DOT com>
Subject: Re: Bug in gcc ?
In-Reply-To: <000401be0c83$4ab6dde0$97afccc2@d9a9a4>
Message-ID: <Pine.SUN.3.91.981110131057.27649A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 10 Nov 1998, Daniel Mironowicz wrote:

> int main(void)
> {
>     int ptr[10];
>     int p = ptr[1],        // check out the ending of this line
>     getch();                // if you remove this line gcc displays error msg
> }

This is not a bug in the compiler.  It is porfectly valid C to say this:

	int p = ptr[1], getch();

This is the same as these two lines:

	int p = ptr[1];
	int getch();

When you remove getch(), the line "int p = ptr[1]," becomes invalid C, so 
the compiler complains.

Where's the bug?

- Raw text -


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