call return inside GCC compound statement expressions -


Can I safely use returns within the GCC compound statement expressions?

defines macros for example I

  #define CHECK_FUNC_RESULT (func) \ ({\ int result = func (); \ if (! Result) return; \ Result; \})   

and use it somewhere else in the code like this:

  int function1 () {returns (if some_condition) 0 ; ... return 1; } Void function2 () {if (CHECK_FUNC_RESULT (function1)} {... to do something}}   

What I really == on function2 (some_condition without any undefined behavior) Can I expect to return from?

This should work, but if your () action If the function1 1 returns is your example: never) it looks like a dangerous construction, because nobody else will ever be executed.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -