BBC BASIC for Windows
« Using SUM on part of an array »
Welcome Guest. Please Login or Register. Apr 5th, 2018, 11:34pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
It's quick, but it's a bodge because it involves temporarily corrupting the contents of the array and then restoring them. Hence the warning about not using it in a program which accesses the array in an interrupt (which could therefore see the corrupted data if the interrupt happened at just the wrong time). That would make it entirely unsuited to going in a library, for example.
I'll have to look into what has changed. Not very up to date this end I'm afraid.
Here are the main things you need to watch out for to ensure any code you write is compatible with BB4W version 6:
Don't make assumptions about the size of variant variables - in v6 they are 80-bits (10 bytes). If you need a 64-bit 'double', always use an explicit # suffix. Don't make assumptions about the size of a structure; if it contains one or more variant members or string members its length will be different. If calculating offsets into an array, be aware that the size of an element may be different (variants are 10 bytes, strings are 8 bytes). If writing assembler code be prepared for new type codes in the CALL parameter block, in particular: 10 = 80-bit variant, 40 = 64-bit signed integer, 136 = moveable string.