C & BASIC head to head etc
: The C and basic head-on thread raised a few things I would like to know..
: Someone said that not all BASIC control structures compile directly ie some are
: library calls, anyone know how to find out which ones so I can avoid them like
: the plague?
Avoiding them won't help much, and will leave you with a strained language.
There are two ways of finding out, number one is compile to ASM source and
do some figuring. If something ends up as CALL B$something then its a
library function.
But if your worried about speed, Ethan Wiener (or something) wrote a book
for PC Magazine called BASIC Techniques and ... something or other. It's
got a lot of examples of how to speed things up and such...
: Someone also said (and provided src example) that
: C can resize arrays while preserving the data. How? In C, variables never move
: (one drawback of BASIC) so if you have an array at x and just after the end of
: array x you have another variable - y, what happens when you want to resize x, C
: can't move the varaible y out of the way so what does it do?
: I assume it allocates another array and copies the info across - but what if
: there isn't enough memory to alloc another array to copy to?
Yes/No. In C there are static arrays and there are not-static arrays. In
either case, you can reference a value outside the defined vaule of the
array, and C won't give two hoots. (Of course it could crash your system
and program... but hey.)
With C you can also use memory allocation, and the command "realloc" which
resizes a memory block which you are using as an array. It's rather simple,
it just reserves more/less memory for you to use.
In BASIC 7.1 there is REDIM preserve which is similar...
--
-Robert Spier
there's layers and layers of nonsense...