switching to C++ compiling by -xc++ (was: gnucash master: Multiple changes pushed)
jralls at ceridwen.us
Mon Apr 28 10:47:07 EDT 2014
On Apr 27, 2014, at 7:58 PM, Mike Alexander <mta at umich.edu> wrote:
> On Apr 27, 2014, at 5:15 PM, John Ralls <jralls at ceridwen.us> wrote:
>> However, I don’t think changing files one by one is wise: It will result in libraries with objects compiled with different compilers, and I worry that that will introduce difficult to understand bugs. That’s not a matter for immediate concern, though, as I expect libqof will consume several months before I’ll start on another directory.
> I don't think that will be as big a problem as you are afraid it will be. For 10 years or so I worked on a program about the same size as GnuCash that we gradually converted from C to C++. Mixing the languages in a library or between libraries didn't seem to be a problem. We had some new libraries that were entirely C++, some that were a mixture, and some that never got touched and stayed in C.
> However, there is one thing I wonder about. When we first started the conversion one of the first things we had to do was add a new main program written in C++ that did a minimal amount of initialization and then called the old main program (renamed appropriately). Many C++ features didn't work right without that, although the basic stuff worked ok. I think we should do the same thing in GnuCash as soon as possible to avoid problems.
I agree, though I want to see what happens when I start introducing templated code at the library level. My next experiment will be to replace the guts of GncGUID with boost::guid, which should be pretty simple. Just about everything in GnuCash uses it, so it has a nice potential for spectacular explosions that will tell me if this approach is going to work out. Kind of a "Mythbusters" approach to programming. ;-)
I'll make gnucash-bin.cpp after that.
More information about the gnucash-devel