Error: expected expression before return
Itzhack Goldberg
ITZHACK@il.ibm.com
Sun Mar 18 15:03:00 GMT 2007
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
More information about the Gcc-help
mailing list