long[@buffer+howmany?]
Erik Friesen
Posts: 1,071
I'm having a problem program moment.· Using long[noparse][[/noparse]@buffer+x] does x=one byte address, or four.
Comments
The "type cast" is only for the data, not the address.
It seems that these two are equivalent though:
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
Often it seems to me as if my programs will only work with one form or the other, without a clue for which or why,
especially with the byte[noparse][[/noparse] ] function, for example: byte[noparse][[/noparse]x+i]<>byte[noparse][[/noparse]x][noparse][[/noparse] i ].
Maybe I'm blind to a typo every time, but whenever it doesn't work, changing it does fix it.
I specifically remember the second program I wrote with byte[noparse][[/noparse] ] didn't work so I checked the manual,
and learned the second form, used it, and it worked.
Post Edited (VIRAND) : 8/3/2008 7:41:32 AM GMT
Is that correct, they're not synonymous ? I would have thought they were but cannot try it at present.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I generally now use the [noparse][[/noparse]x+i] format.
When I run it, I get identical values across each line.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
Next time I find an example I will preserve it and post it.
For Byte, they should be equivalent.. words will of course only lop off the lowest bit.
Ignore the dots in the parens.. stupid forum software destroys the formatting even if its in a code block..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pull my finger!
I couldn't see anything wrong with the bytecode generated there. Note that the two conditionals can never both be true so it's an infinite loop; maybe there's some other problem you are seeing ?
For "long[noparse][[/noparse]x][noparse][[/noparse]y]' and "long[noparse][[/noparse]x+y*4]", the compiler generates different bytecode but the functionality appears to be the same for long, word and byte.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
Your third line is inconsistent with experience. It should read:
Erik, if you don't mind the suggestion, a root cause analysis can go a long way to keeping problems like you mention from coming back.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pull my finger!
I would agree with that hypothesis. I clearly remember replacing byte[noparse][[/noparse]x] with byte[noparse][[/noparse]x][noparse][[/noparse]0] to get something working.
I'll look for that program.