Re: Error: expected expression before return

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

 



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


[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