This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Error: expected expression before return
- From: Itzhack Goldberg <ITZHACK at il dot ibm dot com>
- To: Dave Williss <dwilliss at microimages dot com>
- Cc: gcc-help at gcc dot gnu dot org, Tehila Meyzels <TEHILA at il dot ibm dot com>
- Date: Sun, 18 Mar 2007 13:15:00 +0200
- Subject: Re: Error: expected expression before return
Hi,
Thanks for the quick and accurate answer.
However I wonder about how gcc/gdb handles compound statements like:
((rtrn1=open("/tmp/file1",O_RDONLY))) &&
((rtrn2=open("/tmp/file2",O_WRONLY))) ...
What I see is, that the two expressions are treated as one statement when I
try to "step" through the code with gdb...
Is there a way/flag I could introduce so that I could indeed step through
the statement, one expression at the time ?
Thanks in advance,
- Itzhack
Dave Williss
<dwilliss@microim
ages.com> To
Itzhack Goldberg/Haifa/IBM@IBMIL
15/03/07 15:59 cc
gcc-help@gcc.gnu.org, Tehila
Meyzels/Haifa/IBM@IBMIL
Subject
Re: Error: expected expression
before return
Itzhack Goldberg wrote:
> The following program doesn't pass compliation:
>
> #include <stdio.h>
> int izik()
> {
> ( 1 == 1 ) && return 0 || return 1 ;
> }
> int main()
> {
> int rtrn = izik();
> }
>
>
> The error is: error: expected expression before 'return'
>
>
int izik()
{
return ( 1 == 1) ? 0 : 1;
}
This is C, not Perl :-)
Shalom