Pelles C > General discussions

warning #2046

<< < (2/2)

frankie:
Thanks John.
For the sake of precision the message is confusing because it leads the user to think that the whole expression, included the function calls, are removed (not executed).
But this would be uncompliant with the standard because could lead to make ineffective all the eventual side effects of the uncalled functions, that instead are, compliantly, executed anyway.
Different is the case of expressions without function calls, that can be removed completely, unless they induce side effects too.
I.e.

--- Code: ---int a = b + c;    //If 'a' is never used should warn, and whole expression is not coded

--- End code ---
If we introduce a side effect with an auto-increment:
I.e.

--- Code: ---int a = ++b + c;    //If 'a' is never used should warn, and the expression not coded, but the auto increment is coded anyway

--- End code ---
With this second case, if we use the variable 'c' we will get it incremented by 1 anyway. If we don't use 'c' the whole expression will be discarded.
The compiler seems behave correctly.

Navigation

[0] Message Index

[*] Previous page

Go to full version