|Free42 and the whole C-vs.-C++ issue|
Message #12 Posted by Thomas Okken on 27 Oct 2006, 10:18 p.m.,
in response to message #11 by Jeff O.
Well shoot, there goes my plan!
The best-laid plans of mice and men... ;-)
Seriously, I was under the impression that Free42 required just a C compiler, so I was hopeful that the hpgcc route might work.
Before version 1.3, Free42 was pure C; versions 1.3.* are C++, but only in the sense that I made whatever modifications were necessary to get everything to compile as C++ -- but the code would still compile with a plain old C compiler, as long as you changed the Makefiles appropriately, changed all the *.cc filename extensions to *.c, etc.
In version 1.4, however, I introduced the decimal code which requires C++, partly because Hugh Steers' BCD20 library is C++, and partly because of the way I integrated that library into Free42. It wouldn't be all that hard to rewrite BCD20 in pure C, but modifying Free42 would be a chore... Imagine looking for all occurrences of "a+b", where a and/or b are floating-point numbers, and having to replace that with "bcd_add(a, b)". It's possible, of course, but it would be a pain... And, on top of all that, who would maintain such a pure-C version of Free42? Not me...
Maybe there will be an hpgcc++ someday.
I hope so!
In the early days of C++, this probably wouldn't even have been an issue, because back then, compiling C++ was a two-stage process, with the first stage being a C++-to-C translator, and the second stage being a plain old C compiler. Given a C++-to-C translator, it might still be possible to convert the Free42 source code to something hpgcc can compile, but I don't know if anyone even maintains that kind of thing any more... Once the gcc suite started supporting C++ with a dedicated compiler front-end, I lost interest in the whole C++-to-C translation approach, so I really couldn't say.
The other thing to hope for is that OpenRPN will mature into an actual product; if that happens, it will no doubt be possible to compile code for that platform using state-of-the-art C++ compilers (much like we can use similar tools to develop for PDAs today).
Edited: 27 Oct 2006, 10:23 p.m.