Is there any difference either the result or code generated between different ways of casting variables?
For example, if I have a variable 'Number' defined as a LongInt, is Byte(Number) the same as Number.byte0?
Simple question, but I can't find anything in the manual and have realised I use both variants in my code.
Difference between Byte() and .byte0
Moderators: David Barker, Jerry Messina
-
- Posts: 219
- Joined: Wed Sep 11, 2013 1:27 pm
- Location: Chesterfield
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Difference between Byte() and .byte0
There's no difference that I'm aware of, at least not with that simple example.
Both versions just take the LSB and copy it to the byte variable. Same code.
One difference that I know of is you can use the 'cast' form with constants, like b = byte(-1)
Both versions just take the LSB and copy it to the byte variable. Same code.
One difference that I know of is you can use the 'cast' form with constants, like b = byte(-1)