C Evaluation
|
07-15-2022, 11:20 PM
Post: #5
|
|||
|
|||
RE: C Evaluation
If you have ever worked with lex and yacc (Yet Another Compiler Compiler) you would understand why evaluation order is not guaranteed. The "natural" way to use yacc puts the operands and operators on a stack and when you "pop" them, they come out in reverse order.
C does have the comma operator which guarantees left to right evaluation, but the commas in function calls are *not* comma operators. If expression does guarantee left to right evaluation and short-circuiting so that you can do something like: if (p && (p->status == 0)) so that p->status is not evaluated if p is NULL. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
C Evaluation - toml_12953 - 07-14-2022, 08:06 PM
RE: C Evaluation - Craig Bladow - 07-14-2022, 08:34 PM
RE: C Evaluation - cruff - 07-14-2022, 11:44 PM
RE: C Evaluation - Sylvain Cote - 07-15-2022, 01:12 AM
RE: C Evaluation - KeithB - 07-15-2022 11:20 PM
RE: C Evaluation - ijabbott - 07-16-2022, 05:02 PM
RE: C Evaluation - robve - 07-16-2022, 06:43 PM
|
User(s) browsing this thread: 2 Guest(s)