Hi Guys,

Just ran into some unexpected behaviour. I wrote:

  chr = 0
  serial_hw_read(chr)
  if (chr == 0) then return end if

And it did not work like it should. This is how it should be:

  if (serial_hw_read(chr) == false) then return end if

However.... the code in _serial_hw_read() is

  if PIR1_RCIF then
     data = RCREG
     PIR1_RCIF   = false       -- [email protected] 12-sept-08
  else
     return false  ;result = false
  end if

When false is returned, there 'data' is not touched. Why doesn't is work
then. Well, because:
   function _serial_hw_read(byte *out* data) return bit is

The value 0 assigned is not passed to the function, so it is not returned.
So all works like it should, but is it like we want it to be? I was fooled
here and so might others. Maybe it would be a good idea to never use 'out'
without 'in'? What do you think?

Joep

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to