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: John Love-Jensen <eljay at adobe dot com>
- To: Itzhack Goldberg <ITZHACK at il dot ibm dot com>
- Cc: MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Mon, 19 Mar 2007 07:41:44 -0500
- Subject: Re: Error: expected expression before return
Hi Itzhack,
> Have you used any special flag ?
Nope. I just do the 's' (step into) which goes into the first
sub-expression's function call, 'fin' (finish) to step out of that function,
's' into the second sub-expression's function call.
> and one would like to be able to break at the particular expression/line.
> Is is possible to break on the third expression of such a compound
> statement ?
You can break on an expression.
You cannot break on a SUB-expression. (Although I did have a debugger that
walked through sub-expressions, but that was on the Amiga.)
If you want to do something like that, you might want to consider pulling
your SUB-expressions out of the expression and in their own expression.
It's not any slower. Trust the optimizer. And it makes the if expression
more legible, which is better mojo for maintainability.
int rtrn1 = open("/tmp/file1", O_RDONLY); // -1 on error
if (rtrn1 != -1)
{
int rtrn2 = open("/tmp/file2", O_WRONLY); // -1 on error
if (rtrn2 != -1)
{
// yada yada yada
}
}
BTW: you did know that open returns -1 on error, correct?
HTH,
--Eljay