Re: Code guidelines, state of C++ compilers used, and general C++ comments

Subject: Re: Code guidelines, state of C++ compilers used, and general C++ comments
From: Eric W. Sink (
Date: Thu May 11 2000 - 09:04:03 CDT

Sorry this response is late. I really like the attention to coding
detail displayed in this note, and I wanted to offer a few comments.

> 1. Prefix 'i' usually denotes an index in HN, why 'n' (both as the
> mathematical integer representation, and it's the first letter of
> 'number') should be used as the general integer prefix. Prefix 'i' should
> be used for indexes.

I didn't know that! I always wondered by there was an apparent
inconsistency with the usage of 'i' vs. 'n' for integer types.

> Q: Is anyone using/aware of any compiler that we support that have int's
> of less than 32 bits?

Not that I know of.

> 12. Add: Never EVER put a member variable under any other access
> specification than private. Derived classes have NO business of probing
> the baseclass' private parts (pun intended).

I agree with this. I never liked 'protected' as a language feature.

> What initially got me thinking about this is that in AbiWord, many
> classes participates in intrusive d.l.-lists [as siblings], and numerous
> are the places where this code is duplicated. This adds bloat, and also
> opens up the distinct possibility for copy'n'paste errors and so on.
> To use an intrusive double linked list template class could really be of
> benefit. An (incomplete) example of how such an interface could look like
> can be found with my patch of fp_Run.

I always sympathize with the desire to use templates in this way, but
I don't think the hassle is worth it yet. The CM problems on the
AbiWord project are already bad enough as it is. I certainly believe
that C++ will erase its reputation for unportability due to differing
compiler implementations, but I'd like to see somebody else be the
bleeding edge of this wave.

> It's always legal in C++ to delete a null pointer, e.g.
> delete (int*)0;
> The compiler does all the checking for you.

I didn't know this either, and I'm not sure I like it. Then again,
Bjarne has *never* called me for advice.

Eric W. Sink, Software Craftsman
SourceGear Corporation

This archive was generated by hypermail 2b25 : Thu May 11 2000 - 09:04:05 CDT