Error: expected expression before return

John Love-Jensen
Mon Mar 19 12:59:00 GMT 2007

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?


More information about the Gcc-help mailing list