QBasic syntax error?

J

Jasen Betts

Jan 1, 1970
0
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.

there's no shortage of bad programmers.
What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?

So you think an older programming language is better?
 
J

Jon Kirwan

Jan 1, 1970
0
Cool, I'll give it a try.

George H.

If you want, you can just start up the DOS box, then type:

MODE CON: LINES=50

Then start up QB45.

Jon
 
B

Bill Bowden

Jan 1, 1970
0
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.

-Bill
 
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.

Why strange? There is no standard BASIC, or I guess it's really
"there's so many to choose from".
 
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 stop then? Certainly bugs don't care that the product was
shipped. IME, they rather like a new set of hands to uncover them.
 
B

Bill Bowden

Jan 1, 1970
0
Why strange?  There is no standard BASIC, or I guess it's really
"there's so many to choose from

Well, I've only used 4 versions, Borland, Microsoft, HP, and
Commodore. All of them support the basic DATA statement, and I never
had trouble with comments. I have noticed that Borland runs about
twice as fast as QB. Maybe QB is an 8 bit program, and Borland is 16
bit? I think Borland Turbo Basic is now called Power Basic?

-Bill
 
J

Jasen Betts

Jan 1, 1970
0
PowerBasic isn't old.

Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING,

yeah, I remeber seeing those features in 1988
jillions of cool intrinsic string functions, all sorts of data types,

and string functions that aren't functions, arbitrary size limits and
other warts,
great graphics built in.

I haven't touched basic for about 5 years but last time i wanted to
draw an oblique ellipse but it couldnt do that.
Basic has evolved a lot, and c has hardly evolved at all.

there's been three standards since 1980, and the developemnt to back
those up,
 
Top