Page 1 of 1

Difference between Byte() and .byte0

Posted: Fri May 19, 2017 3:36 pm
by SHughes_Fusion
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.

Re: Difference between Byte() and .byte0

Posted: Fri May 19, 2017 7:46 pm
by Jerry Messina
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)