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

Re: C/C++ layering in PFile

Bjarke Hammersholt Roune wrote:

>I must admit I'm a bit confused as to what determines wheter functionality
>is implemented in C or C++. It seems pretty random to me. If there is some
>kind of system, it eludes me. Is there?

Yes, but it changed over time (in the beginning the plan was to implement
most of the functionality in a procedural way) and some parts are lagging
behind there.

The things that *should* (IMHO) be plain functions (not bound to a class)
* The API functions (of course)
* The specialized API functions (e.g. ppf_OpenInPak ())
* ppf_WriteLEInt32 () etc

Everything else makes more sense when arranged in classes.

>A related thing with ppf_URLInfo that puzzels me somewhat is:
>struct ppf_URLInfo
> const char *Path;
> ppSizeT     Length;
> ppfFSType   FS;
>  int         PartCount;
> ppOffsetT   PartStart [PPF_MAX_PATH_DEPTH];
> ppSizeT     PartSize  [PPF_MAX_PATH_DEPTH];
> bool        IsAbsolute;
> bool        PathWasAllocated;
> ppf_URLInfo (void) throw () {}
> ~ppf_URLInfo ()    throw ();
>Is this C or C++ ? Well, I can tell that it must be C++, since there's a

C with a destructor for convenience. But you're right, ppf_URLInfo should
be a nice little class. <time passes> Ok, I now wrote that - almost
completely. Then I had to give my father a little
scanning-retouching-printing intro ;) And now I'm too tired to finish it.
I'll send it tomorrow.

>btw, why locals in StartWithCaps? It makes them look like classes or
>functions, and I don't really see how having them start with a capital
>letter is a benefit.

Not like functions (the () are missing - that's really clear), and they
also can't be misinterpreted as classes because that's obvious from the
What do you mean with the "start with a capital" sentence? As opposed to
startWithSmallButAllElseCapped or everything_small_and_underscores
or something else?


Drive A: not responding...Formatting C: instead