Numeric Variable Type Conversions
william chan
Posts: 1,326
Hi,
I can't find any type-conversion (type-casting) commands in SPIN.
1. What happens when we assign a byte value to a long variable?
Will the value be preserved?
2. When we assign a word variable with a value in a long variable?
3. What happens if a procedure requires a byte parameter, but instead we supply it with a long?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
I can't find any type-conversion (type-casting) commands in SPIN.
1. What happens when we assign a byte value to a long variable?
Will the value be preserved?
2. When we assign a word variable with a value in a long variable?
3. What happens if a procedure requires a byte parameter, but instead we supply it with a long?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
(1) The sign will not be extended, there is a specific operator if you need that: ~
(2) The sign will not be extended, there is a specific operator if you need that: ~~
(3) This - again - is a nonsense question
You can cast with byte, word, and long. You get lots of "flexibility" here; don't hurt yourself.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley
Traffic is slow at times, but Parallax orders·always get here fast 8)
Post Edited (jazzed) : 3/7/2008 12:11:32 AM GMT