I did a relational database with four files in BBCBASIC and it works very well. The size is about 1000 lines of code and gave me an good insight in how file pointers works. I wanted to add more features and this was very hard for me to add. I had somehow lost the overview and the complexity was a big struggle.
I realized it was my own short comings partly because structural code issues and my dyslexia. I badly needed a more advanced debugger and much more strict typed language and more freely indention.
QB64 was a possibility, but it compiles slowly each time you run the code and don't have an immediately mode, but QB64 have a nice community. QB64 have strutures, but more primitive than BBCBASIC and it have strict typing, but the debugger was a mystery to me. I also had a look at BASIC256 and it's the most intuitive Basic I tried, but it’s constructed to learn to program and does it very well - even with networking. I had a go with PureBasic and I think you can do anything with it, but as far I know it don't support console very well. FreeBasic have many features, but the setup and IDE was bad. I think that BBCBASIC for Windows, is the best Basic all in all and it's very fast. The help I had received in this forum have been very helpful.
Lastly I ended up with C++ and for a Basic programmer it's intimidating. There are lots of IDE's and I decided give it a go with Code Blocks. I had some tries and there is lot to learn, but after a while it makes a bit sense. There are some great teachers on the net who really understand to help beginners. I also found a graphics.h library which is almost as easy to use as BBCBASIC, but I don't think it's faster. Maybe graphics will run faster in release mode...
I can use C++ in a BBCBASIC way with functions and procedures (void functions) and use a kind of C++ light and using console (not Windows). A bit deeper I could reuse struts just like BBCBASIC, but struts in C++ can also have access rights among tons of other features. Struts in C++ are very similar to classes and inheritance. My knowledge in BBCBASIC's file pointers can also be reused in C++. The way the my database works in BBCBASIC is almost identical to what I do in BBCBASIC.
For now I'm "translating" BBCBASIC into C++ and so far it's is going ok, but slowly.
I have not dropped BBCBASIC and next time I do a Basic program, it will be much more structured and much more use of local variables. C++ actually gives me a better insight in programming and much more structured, but I really miss the immediately mode.
Ivan
BBCBASIC and C++
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
BBCBASIC and C++
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.
-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: BBCBASIC and C++
I'm glad you're getting some benefit from using C++ (ie. insights into programming) but for most practical purposes C++ offers few advantages and even those could be nullified if you learned assembler.
For example, your typical program waits for user input and for the user - a mere human with the need to move a mouse or reach out and tap a key - it makes no detectable difference whether the keyboard or mouse are polled 100 times a second or 1000 times a second.
On the other hand, it is conceivable that with a very large database, sorting in C++ might be noticeably faster than sorting in BASIC but, as I say, learning to write assembler would probably be even faster. I realise, however, that learning C++, which is a relatively high-level language, is probably easier than learning assembler.
As you say, being able to run and test your program immediately without needing to compile it is a huge advantage of BASIC.
For example, your typical program waits for user input and for the user - a mere human with the need to move a mouse or reach out and tap a key - it makes no detectable difference whether the keyboard or mouse are polled 100 times a second or 1000 times a second.
On the other hand, it is conceivable that with a very large database, sorting in C++ might be noticeably faster than sorting in BASIC but, as I say, learning to write assembler would probably be even faster. I realise, however, that learning C++, which is a relatively high-level language, is probably easier than learning assembler.
As you say, being able to run and test your program immediately without needing to compile it is a huge advantage of BASIC.
Re: BBCBASIC and C++
Assembly language programming can be such a time-consuming and even soul-destroying experience! These days I try to avoid it as much as possible, and if I need a bit of code that's faster than what's achievable with BBC BASIC (which isn't very often in all honesty), then I can write some C code in a matter of minutes, compile it to a DLL (for Windows) or an SO (for Linux), and then access the resulting super-fast function(s) from my BASIC program. I can achieve in literally minutes of C coding what can take a few hours with assembly language. I've also noticed on more than one occasion that compiled C beats or at least matches the speed of my hand-coded assembly language routines, and this is down to a number of reasons. I'm pretty crap at assembly language (that's one important reason!), but the C compiler can make better use of the available registers than I can, and it can more optimally sequence instructions than I can. And on the rare occasions that I know what I'm doing, it can generate vectorized code (SIMD instructions - SSE4.2 etc.) so that the resulting generated code runs like a rocket on steroids. So, in my view, I wouldn't bother with assembly language - just write your speed-critical functions in C or C++, compile to a library (or get an assembly language dump from the compiler and paste it into your BBC BASIC program [some modifications will be required!]), and save yourself a great deal of time and energy.KenDown wrote: ↑Fri 17 Sep 2021, 06:08On the other hand, it is conceivable that with a very large database, sorting in C++ might be noticeably faster than sorting in BASIC but, as I say, learning to write assembler would probably be even faster. I realise, however, that learning C++, which is a relatively high-level language, is probably easier than learning assembler.
-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: BBCBASIC and C++
To DRM: Yes, I am aware of SORTLIB. I merely mentioned a sort as a processor intensive task that might be faster in assembler than in BASIC.
To David Williams: Your comments are very interesting. Thanks. Just out of interest, what program do you use for writing and compiling your C++?
To David Williams: Your comments are very interesting. Thanks. Just out of interest, what program do you use for writing and compiling your C++?
Re: BBCBASIC and C++
Not C++ in my case, just plain old C.
I currently use the GNU C compiler via MinGW ("Minimalist GNU for Windows"), totally free and quite easy to set up.
https://osdn.net/projects/mingw/
https://en.wikipedia.org/wiki/MinGW
-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: BBCBASIC and C++
Thanks. I'll investigate it. I've been wanting to get into C again for some time.
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: BBCBASIC and C++
I did not get any response by mail, but to day I logged in I saw your replies - thanks:
I did learn 6502 assembler in the good old times (1985) and still remember many instructions: I had a short look at assembler and if have to learn assembler it must be RISC - right
Actually I did a Castle Quest clone with lanes, flicker free scrolling etc. but never finished... 
Assembler - it took some time to understand, but when I did, it was a fantastic feeling. In C++ I' beginning to have the same feeling again.
I think C++ have some very nice features for (dyslectic) me like prototyping and you have to explain everything. If you declare a variable and try to declare the same variable again in it's scope, it wont work. If you declare a variable and don't use it the compiler will warn you. You can also format the code just like you want, but there are of course guidelines. You can even have comments inside the code if you want. C++ does not care between one ore eg. 100 spaces, so you have lots of freedom.
The IDE saves me for lots of typing errors. If I e.g. have longer variable names, I don't have to type more than a few characters. If you define structs or classes the IDE will assist you when using its members.
The debugger does a huge help for me. Yesterday I had to debug a multidimensional array and I can just place the mouse pointer over the array variable and see each value in the array - fantastic!!! Otherwise I can use the console as I do in BBC BASIC.
After a while I realized that I can have the prototypes in header files and have it like an overview of the code.
In BBC BASIC I’m spending 90% of creative thinking and 10% of language issues. In C++ I’m now at a level where my time of creative thinking is a bit over 50% and is growing each day. It's easier and easier to spot issues in the code and use C++ features which are almost endless.
I decided to in many cases to make my own functions for many things like string and char handling and many other things. Just to have my C++ condition at a certain level. I did a INSTR function and I also made a cursor function because the graphics library I use don't have a cursor.
But I’m also realizing that Richard had made a very fine Basic. In principle programming is the same in BBC BASIC and C++. Many different things from basic can be reused in C++.
If any one will give C++ a try I will gladly recommend some very good teachers who really understand how to explain despite they have very great skills - just mention it!
I did learn 6502 assembler in the good old times (1985) and still remember many instructions: I had a short look at assembler and if have to learn assembler it must be RISC - right


Assembler - it took some time to understand, but when I did, it was a fantastic feeling. In C++ I' beginning to have the same feeling again.
I think C++ have some very nice features for (dyslectic) me like prototyping and you have to explain everything. If you declare a variable and try to declare the same variable again in it's scope, it wont work. If you declare a variable and don't use it the compiler will warn you. You can also format the code just like you want, but there are of course guidelines. You can even have comments inside the code if you want. C++ does not care between one ore eg. 100 spaces, so you have lots of freedom.
The IDE saves me for lots of typing errors. If I e.g. have longer variable names, I don't have to type more than a few characters. If you define structs or classes the IDE will assist you when using its members.
The debugger does a huge help for me. Yesterday I had to debug a multidimensional array and I can just place the mouse pointer over the array variable and see each value in the array - fantastic!!! Otherwise I can use the console as I do in BBC BASIC.
After a while I realized that I can have the prototypes in header files and have it like an overview of the code.
In BBC BASIC I’m spending 90% of creative thinking and 10% of language issues. In C++ I’m now at a level where my time of creative thinking is a bit over 50% and is growing each day. It's easier and easier to spot issues in the code and use C++ features which are almost endless.
I decided to in many cases to make my own functions for many things like string and char handling and many other things. Just to have my C++ condition at a certain level. I did a INSTR function and I also made a cursor function because the graphics library I use don't have a cursor.
But I’m also realizing that Richard had made a very fine Basic. In principle programming is the same in BBC BASIC and C++. Many different things from basic can be reused in C++.
If any one will give C++ a try I will gladly recommend some very good teachers who really understand how to explain despite they have very great skills - just mention it!
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.
-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: BBCBASIC and C++
Thanks for the offer. I did a course in C++ twenty odd years ago and something still lingers. There is not doubt in my mind that Richard's BB4W is far easier for most things and acceptably fast for nearly everything. However I still hanker for the kudos of saying lightly, "Oh, I program in C++".
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: BBCBASIC and C++
I think I will and can use C++ in a “Basic” way. As long I can reuse most of my BBC BASIC skill I’ll will continue, but just the part that makes it relatively easy to use. C++ forces me to think more constructive and after I discovered a graphics library that is relatively easy to use, it’s a joy instead using the very complex and modern graphics. Many C++ features are easy and very logical to use.
I’m writing small business programs for my wife and my self. I know in a second when something is not doing what she wants.
Nothing is stopping me to use BBC BASIC to test logical code and after three month of study it’s mostly easy to switch back and forth between the two languages.
I’m writing small business programs for my wife and my self. I know in a second when something is not doing what she wants.

Nothing is stopping me to use BBC BASIC to test logical code and after three month of study it’s mostly easy to switch back and forth between the two languages.
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.