Re: how to recognize whether code is C or C++?
On May 22, 11:38 pm, Ian Collins <ian-n...@hotmail.com> wrote:
Jeff Schwab wrote:
"More efficient and sensible" is overstating the case.
You're right about publics coming first more often, but
popularity doesn't make it a good idea. I always put
private members first, with fields coming before the
functions that use them. Nothing in my code ever refers to
anything that has not defined yet, except in specific
situations on large projects where there are build-related
concerns. I've been doing this in earnest for about a year,
and so far, I'm very happy with it.
I've always written my classes that way. I find it much more
natural to look up the screen for declarations than down. We
do this everywhere else in our code, so why should class
declarations be any different?
Because in far too many shops, they don't write class
documentation before writing the class itself. And far too
often, the class definition, in the header file, is the only
documentation you have for the class.
As for the position on the screen, when I'm working, the
declarations are above the actual code where they are used.
They're in separate windows in gvim, so I can put them where
ever I want. (Since the two are in separate files to begin
with, I couldn't put them in the same window, even if I wanted.)
One could argue writing the public interface before the
private data it uses is akin to top posting.....
I don't really see the relationship. The code which uses the
declarations is not even in the same file.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34