C++

Anything QL Software or Programming Related.
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C++

Post by tofro »

C++ would be a very good idea, just quite a bit of a weight to lift.

Unfortunately, modern C would be just about the same task - C has been, for the last number of years, morphing from "High-level assembly" towards a language more and more abstracted from the hardware.

Note you can make C68 more ANSI-like by simply putting a "-extensions=yes" on the command line - this makes it at least accept some more modern ANSI-C constructs like C++ comments ("//"), #pragmas, and reserve some keywords like "class", "public", "private" (not that it would do anything with them). It also understands the concept of "restrict"ed pointers.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: C++

Post by EmmBee »

tofro wrote:Note you can make C68 more ANSI-like by simply putting a "-extensions=yes" on the command line - this makes it at least accept some more modern ANSI-C constructs like C++ comments ("//")
I've tried this on a simple program, but get the report: option '-extensions=yes' not recognised.
Apparently, according to the C68_doc, C68 needs to be built with the EXTENSIONS configuration option set.
How does one actually do this? - would be good to have C68 in a modern form.

Michael


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C++

Post by tofro »

EmmBee wrote: I've tried this on a simple program, but get the report: option '-extensions=yes' not recognised.
Apparently, according to the C68_doc, C68 needs to be built with the EXTENSIONS configuration option set.
How does one actually do this? - would be good to have C68 in a modern form.
Michael

That seems to be a typo in the manual (that I simply copied :o ) - the option is in fact

Code: Select all

-extension=yes
and should come last on the command line.

Note while the compiler is then fine about C++ - style comments, the preprocessor isn't quite. When a C++ comment contains the # character or other characters interpreted by cpp, the preprocessor will hickup. So, you need to be a bit careful.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Whopper
Over Heated PSU
Posts: 126
Joined: Tue Oct 24, 2017 4:04 pm

Re: C++

Post by Whopper »

Hi All,

C++, as all programming languages, has it's place in the programmers tool box. Used at the correct time, for the correct purposes, it is invaluable. Used incorrectly it's the foundations of nightmares. I understand TT's, Linus' and many others dislike of OOP. But it isn't the languages fault for its misuse.

I use C, C++, PHP, Assembler, SQL, LISP and any other language that meets my needs. For the usage I wanted in this project, I wanted the ability to have 0 or more LCD screens. I can scan the I2C bus to find out how many (if any) screens there are and programmatically create the objects for them. This is doable in assembler, but not so easy as in C++.


You woke me for THAT!!!
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: C++

Post by NormanDunbar »

Hi Per,
pjw wrote:Wasnt that Linus Torvalds? I know he was pretty abusive about c++. Thought the best thing about it was that it'd keep crappy programmers away from C! ;) (Not my words :!: )
not unless LT wrote it in QL Today! Itvwas definitely TT. I'll check my dvd and see if I can find the issue.

EDIT: http://www.sinclairql.net/qlt/QLToday_V15-I2.pdf - volume 15, issue 2, Dec 2010-Jan 2011, starts page 7.

Cheers,
Norm.
Last edited by NormanDunbar on Wed Feb 13, 2019 10:35 pm, edited 1 time in total.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: C++

Post by NormanDunbar »

Someone with a huge brain, ie, not me, could retarget the lcc ANSII c compiler for QDOS. https://github.com/drh/lcc perhaps?

I'm sure someone did some work on it, but I can't find it now, no matter what I google! :(

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: C++

Post by pjw »

NormanDunbar wrote:EDIT: http://www.sinclairql.net/qlt/QLToday_V15-I2.pdf - volume 15, issue 2, Dec 2010-Jan 2011, starts page 7.
Hi Norm!
A rip-roaringly good read, that. Thanks for the reminder!
Between what TT and LT write, apart from their philosophical objections, its seems to me that C++ is not really suitable for the QL as it would be rather too demanding of resources, although it may appear light, simple, and logical from a programmer's POV. The only good reason to go to the trouble of implementing it would be if there were a clutch of must-have software that needed porting. However, the days of must-have software for the "QL" have passed, to my mind, as there are plenty of less tortuous ways to achieve what you want. Even C is a stretch, if you look at some of the ported software. However, back in the day, there was no choice if you wanted something like Qfax, Lynx, or Ghostscript, as no one in their right mind would take the trouble to write something like that from scratch in S*BASIC and/or assembler for a dying platform..
If someone really has a year or three at their disposal, I can think of better ways to spend it than implementing C++! But then Im totally biased! (and shouldnt have to be ashamed of saying so in this forum! ;) )


Per
dont be happy. worry
- ?
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C++

Post by tofro »

With all due respect, (and I have a lot for Tony) - The linked elaborate in QL today, was more an old man's rant to me when I read it back in 2011 than everything else. It's just proof for the fact that if you start with a broken design, you'll end up with broken software. You could easily write the same article for any programming language.

Just as you can build impressive cathedrals from wood, brick or stone, even concrete (as well as slum huts using the very same materials), write literary masterpieces in English, German or Japanese, you can build software cathedrals and software sonnetts in any language (BTW I consider SMSQ/E as one, at least in major parts), be it assembly, C++ or Forth. The same applies to software Nissen Huts and cheap novelettes. There's software cathedrals and literary masterpieces out there in any language, Assembly, C, C++, even Java (yes, Norman ;) ). But also software penny dreadfuls.

Not everyone is built the same, some programming languages just "click" with one mind, and will never "click" with another. I myself tried with Forth 20 years ago because I thought it was an elegant concept, but could never get my head around it. Most of the elaborates of more than 25 years as a professional software developer and architect, however, I did with C++ (because of the "click").

The QL could well do with a nice, optimizing, modern C++ compiler (If you do it right, C++ is perfectly fine even on slow machines - You can write very nice programs in C++ on an AVR or PIC.) But I'm with you, Per, except someone is really passionate about it, there probably will never be a good C++ environment for the QL.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: C++

Post by XorA »

I spent 2 years making good money writing C++ code for 68332 micro controller based devices.

So any nonsense that 68000 cant handle C++ is exactly that!

There are some modern 68000 C compilers, they just need a QL linker added, someone even started work on one of them in the forum!


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: C++

Post by NormanDunbar »

Hi Tobias,
tofro wrote:... even Java (yes, Norman ;) ).
Tobias
Nothing wrong with Java, I don't know what you mean! (aka, I'm a two faced liar!!) However, https://github.com/NormanDunbar/Tnsnames_checker is my first ever Java program. I also did https://github.com/NormanDunbar/Tns2Toad which was my second.

At this point, I stopped! ;)

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply