But I think the solution to that is to carefully design the objects to only store what is needed in the file
That's no different from making a structure containing the fields needed in the file, and writing that out with a single
fwrite(). And do use the Google if you don't know what something is.
>>57,60
All the C++ features (with few exceptions like... exceptions) can be directly translated to C. That's how the first C++ compilers were built. Quick summary: RAII is something you get by the compiler automatically generating constructor and destructor calls in the right places. Polymorphism is just indirect calling via the vtable. Encapsulation is an overused term that doesn't really mean much here. Operator overloading is a syntactic transform:
astring + "value" ->
astring.operator+("value") (->
string_operator_plus(&astring, "value")). Functors naturally come as an effect of being able to overload
operator(). These features do not add any additional expressive power; they're only shorthands to make some things easier.
Had I the time, I would either update Cfront or write my own C++ to C translator that enables a more incremental approach to optimisation --- instead of having to write everything in C, or directly in Asm, use C++ to generate all the C, then you can optimise the C before going to inline Asm. For example, in the above test program I could rip out everything that
cout generated and isn't used, and still be able to use the advantages of
iostream, operator overloading, etc.
>>59
It's written in C++ too. This shows that it's possible to write efficent code in C++, but you really have to understand how everything works.