I just encountered the following problem
I've a function "detect_US", which should return true when a valid
US-echo is detected
In the main program I call the function like this
if detect_US then
This worked perfect, at least I thought ;-)
For test purposes, I removed "asynch_send_hw" call
and the result was that about my whole program was optimized away :-(
Strictly speaking, this optimization was a correct action,
because I forgot to set a return value in the function "detect_US".
(The US-distance was also transmitted in another place,
therfor I thought the program worked correctly).
And main problem is that the function detect_US was never called !!
So I think at least it's inconsequent to optimize away or not
the function detect_US,
depending on if the "if-statement" contains any functional code.
It would also be a good idea to give a warning when no return value is
set in a function.