[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FileAccess: C or C++ ?

Eelke Klein wrote:

>> C is more controllable (in terms of size and speed), but C++ makes it
>> easier to handle the dir structure etc.

>As long as performance is not really critical it's better to use c++
>streams because its stronger typed, this will make it easier to write

Yes, the stronger type checking (of C++ in general) is quite useful.

>correct code. Also the c++ streams are better when handling user defined
>types since you can overload the stream operators.

Well, that's IMHO not really relevant for the core functionality, just for
the interface. And we already agreed to make both a C and a C++ interface

>So as long quality and correctness is more important then speed I would
>say c++ otherwise c should be used. This asumes that the c file
>functions are faster then streams which I believe is allmost allways
>true, thought I did not test it.

Hmmmm, what about some hybrid - using C++ classes to gain from stricter
type checking, the added "you can't forget to call it" safety of
constructors and destructors and perhaps even exception handling for nice
and controllable error handling, together with C's fast file handling

I mean - the C++ reatures I cited above AFAIK don't slow things down if an
averagely (expr?) well optimizing compiler is used (such as egcs).