Loading ...
Sorry, an error occurred while loading the content.

JAL the perfect optimalisation ?

Expand Messages
  • Stef Mientki
    hi All, 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
    Message 1 of 1 , Aug 23, 2005
    • 0 Attachment
      hi All,

      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
      <JAL>
      if detect_US then
      asynch_send_hw (US_distance)
      end if
      </JAL>

      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.

      Stef
    Your message has been successfully submitted and would be delivered to recipients shortly.