Re: Error: expected expression before return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx, 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux