[hatari-devel] C++

Eero Tamminen oak at helsinkinet.fi
Sat Oct 1 19:30:54 CEST 2011


Hi,

On lauantai 01 lokakuu 2011, Markus Heiden wrote:
> >> Except for this, I prefer working in C, but it's just my point of
> >> view.
> > 
> > I second that, I also prefer plain C.

Likewise, but I'm a bit ambivalent on this because Aranym & WinUAE
are C++.  Very restricted[1] C++ isn't too bad and C++ has a bit better
type checking that C.


> I did not want to convert the whole hatari project to C++, but I asked
> for C++ because it allows more modularization of the code. Due to this,
> the code is less coupled to each other, what makes it easier to unit
> test exactly one part of the code, e.g. by mocking the not tested parts.
> As for the hd part, oo-programming could ease the programming of the
> class 0 and class 1 parsers and would allow e.g. easier support of
> multiple hd images.
> 
> I think that the core code should stay written in a procedural way (C)
> for performance reasons. But maybe even this code could benefit from
> some of the C++ features, like exceptions.

Hatari code aims to be portable.

According to Mozilla/Firefox portability guideline[1], one shouldn't use
neither exceptions, RTTI, static objects, iostream or namespaces (and few
other minor things) in portable C++ code.


> But e.g. inheritance should be avoided.

There are some issues in C99 (for which Hatari currently aims for)
and C++ code compatibility.  If part of the code is C++, whole Hatari
should be compiled with a C++ compiler -> issues reported by the (to
some extent) better / different type checking in C++ need to be fixed.

If you compile Hatari with C++ compiler instead of C one, how
many additional warnings do you get and how much effort do you
think it would take to fix them?


	- Eero

[1] https://developer.mozilla.org/en/C___Portability_Guide



More information about the hatari-devel mailing list