|
|
|
|
|
by adrian_b
949 days ago
|
|
That is not a good pro argument. When this operation is undefined, you must always put a branch instruction in front of it, on any architecture, regardless if it happens to do what you want. Even when you know precisely the type of CPU on which the program will be run, you would need to use inline assembly to be sure of the behavior of the program. When you can guarantee that the operand will never have the undesired value, then no branch instruction would be used on any architecture, regardless how the C standard would define the operation. It is always better when the programming language standard defines completely all operations. In the worst case, when two possible operation definitions are widespread in hardware implementations, two distinct operations should be defined in the language, allowing the programmer to choose the one that is more efficient on the intended target, but knowing that the program will remain correct regardless for which target it is compiled. |
|