I'm interested in learning C++, and would like to know if there are tutorials for doing Amiga-specific coding with C++. I'm not sure if there is anything special to doing AmigaOS function calls, opening and using Amiga libraries, etc. from within constructors or destructors, or otherwise doing C-ish Amiga stuff within C++ and its way of doing OO coding.
Fri, 2015-03-27 06:53
#1
C++ tutorial for Amiga coding?
@billt
http://www.solie.ca/articles/map/proglang/proglang.html
Welcome and have a look at what current OS4 leader of development says.
@billt
I don't remember seeing any Amiga-specific C++ tutorials. However, C++ is perfectly usable within certain limits. At the moment we don't have support for the C++ 2011 standard or newer (need a compiler update and updated std-lib). IIRC, exceptions work properly in single-threaded environments only.
Also, while you probably could use C++ internally in a shared library, the library's API must be plain C, and I'm not sure if exceptions could be used or not (what would happen if an exception was thrown and not caught within the library?).
I do hope that we can get C++ 2011 and newer at some point. More and more open-source projects use it, and the standardised threading model is very useful (amongst other things).
Hans
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work
@billt
http://os4depot.net/index.php?function=showfile&file=game/board/stockfish-5.lha
I recently built Stockfish 5 chess engine for OS4, see web link above, which is entirely written in (non Amiga-specific) C++.
From OS4 perspective I got the feeling that the OOP "fundamentals" of the language are well supported, while the "newer" (and sometimes "exotic") features may not be available in a short time.
Depending on what you want to achieve, I suggest a bit of research and experimenting to understand the limits and constraints.
Thanks all,
I'll read up on patterns and check into some code examples out there.
I'm curious, what all would need to happen to bring us up to modern/current C++? Is that merely a new version of g++? Or is that also an update to standard C++ libraries ported to AmigaOS? Or is that also enhancements to AmigaOS itself (such as for C++ threading?)
While I wouldn't expect to need anything fancy as I come up to speed on the basics, I am curious about the effort and pieces required for the fancier stuff, as I do not know at what point I might bang my head into those limitations.
@billt
I could be wrong, but I think that we need an updated G++ and updated standard C++ libraries.
I'd love to be able to use C++11 on AmigaOS, because the new features such as the threading model are very useful.
Hans
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work
If you'd like an example of some amigaish C++ coding take a look at the blender src on os4depot.
Specifically the ghost GUI / system subsystem.
once unpacked find it here
blender-src/intern/ghost/intern/GHOST_WindowOS4.cpp
and other related related files ending in OS4.cpp
You'll see you can mix C++ and AmigaOS C fairly easily, and under OS4 you can take advatantage of interfaces to store local versions in classes as needed.
[edit] fixed lousey grammer