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

C/C++ layering in PFile

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?

If there isn't, I strongly recommend getting one.


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
constructor and destructor. But even though it must be C++, everything is
done using a top-down, clearly C, approach. Ie, no data members are
protected by accessor methods, and the code that offers actual functionality
to ppf_URLInfo is global, and therefore external to the class itself. Why
isn't the functionality of the class declared as methods of the class? You
can't use the URL process functions from C anyway, since parts of
ppf_URLInfo is C++.

Another thing is that this doesn't follow the practice recommended in the
coding standard:

"Make it easy to distinguish between member and local variables
One method to archieve this is to prepend all members with "m_", another is
to write
members in small_with_underscores and locals in StartWithCaps. Globals
shouldn't be
used anyway, so they don't turn up here."

According to this recommendation, the members of ppf_URLInfo is local.

Am I overlooking here?

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.