This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]