G
George Herold
- Jan 1, 1970
- 0
Oops, my fault I was thinking of Robbiehttp://en.wikipedia.org/wiki/Robbie_(short_story)
double oops, I missed a )
http://en.wikipedia.org/wiki/Robbie_(short_story)
Oops, my fault I was thinking of Robbiehttp://en.wikipedia.org/wiki/Robbie_(short_story)
One of my guys wrote a C program (GCC, linux) that involved some signal
averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array.
It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR
loop with the obvious subscripts, no pointers or anything, 8 lines of code or
some such. It took a minute or two to code and compile. Mine was 4x faster than
his. After a day of futzing with compiler optimizations and stuff, he got his
runtime down to 1.2x of mine.
What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?
Cool, I'll give it a try.
George H.
Comments are the problem. I went through a bunch of trouble
to set up a VM with a 32-bit Virtual XP and then copy all my
QBASIC stuff over from an older machine to try it out after
posting my response.
It was pretty easy to test. I didn't use just your code. I
used some I wrote, too, just to be absolutely sure.
No comments on DATA statements in QBASIC. The documentation
even mentions it: "A remark can be inserted on a line after
an executable statement if it is preceded by the single-quote
form of REM or if REM is preceded by a colon." Note the use
of "executable statement" in the above description. DATA is
not an executable statement.
Besides. I tried a lot of different ways to check this out.
You can't do it. Check it out yourself. It will actually read
up the comment, if you try using a string variable instead of
a numeric one. It is NOT a comment on a DATA statement. It is
part of the data, like it or not.
Jon
Ok Jon, I added a colon at the end of the DATA statement followed by
the comment, and the problem went away. Still strange why Borland
Turbo Basic behaves differently. Jasen also had the right answer.
He wrote the obvious c code, a loop with pointers and an add.
PowerBasic isn't old.
Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING, jillions
of cool intrinsic string functions, all sorts of data types, great graphics
built in. Basic has evolved a lot, and c has hardly evolved at all.
The best programming language around is probably Ada, but few people are willing
to invest the modest amount of discipline that it requires. Most people prefer
to type fast and debug until they have to ship.
Why strange? There is no standard BASIC, or I guess it's really
"there's so many to choose from
PowerBasic isn't old.
Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING,
jillions of cool intrinsic string functions, all sorts of data types,
great graphics built in.
Basic has evolved a lot, and c has hardly evolved at all.