1 |
On 06/27/2010 06:52 AM, Enrico Weigelt wrote: |
2 |
>> remark #981: operands are evaluated in unspecified order (tons of them) |
3 |
>> return strcmp( left.c_str(), right.c_str() )> 0; |
4 |
> |
5 |
> I'm not sure if this really qualifies an warning, since - AFAIK - |
6 |
> C spec never said, that there is an evaluation order for |
7 |
> function parameters. |
8 |
> |
9 |
|
10 |
I could see how somebody might make that assumption (incorrectly), and |
11 |
get burned by this. However, creating local variables just to hold |
12 |
intermediate results so as to not embed them in function calls seems to |
13 |
be a lot of overhead - certainly in terms of readability, and I can't |
14 |
think of a situation where the compiler would have to do it on its own. |
15 |
I guess religiously doing this might make the code less likely to |
16 |
contain very subtle bugs, but perhaps it is a bit over the top for |
17 |
anybody who wouldn't be otherwise developing in ADA. |
18 |
|
19 |
Rich |