K
Kenneth Brody
(From something brought up on "Help with array/pointer segmentation
fault needed" thread.)
Is "?" a sequence point?
Or, more directly, is the following defined?
/* Will "ptr" be guaranteed to have been assigned before the "?"
* part is evaluated?
*/
foo = ( ( ptr = some_long_expression ) != NULL )
? ptr->bar
: NULL;
What about this?
/* Is the increment of x guaranteed to be complete before the
* "?" part is evaluated?
*/
foo = ( ++x == end ) ? x : y;
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
fault needed" thread.)
Is "?" a sequence point?
Or, more directly, is the following defined?
/* Will "ptr" be guaranteed to have been assigned before the "?"
* part is evaluated?
*/
foo = ( ( ptr = some_long_expression ) != NULL )
? ptr->bar
: NULL;
What about this?
/* Is the increment of x guaranteed to be complete before the
* "?" part is evaluated?
*/
foo = ( ++x == end ) ? x : y;
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>