Topic: friend inline vs inline friend


Author: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Date: 1996/02/01
Raw View
In article <sc68e0s5bn.fsf@lnscu1.lns.cornell.edu>
nk@lns598.lns.cornell.edu (Nobuhiko Katayama) writes:

|>  Where in the draft standard, if any, says one can use (in the
|> class declaration),

|> friend inline void a(A&);

|> but not

|> inline friend void a(A&);

Nowhere that I can see.

The keyword `friend' occurs as part of the decl-specifier-seq.  This
is an unordered sequence of keywords and typenames.  As far as I can
tell, even

 const char inline unsigned friend * f() ;

is be legal.  (Just because you can do it doesn't mean you
should:-).

In general, I think that good coding practice would impose a
systematic order of some sort, but the importance is consistency, not
the actual order.  (My own preference is: storage-class/typedef/friend
inline virtual/explicit type-specifier cv_qualifiers.  Withing the
type-specifier, I would generally place signed/unsigned first, and
short or long before int or double.  This preference is at least
partially historically conditioned, though.  It corresponds to what I
saw in the first C code I read.)
--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, itudes et rialisations en logiciel orienti objet --
                -- A la recherche d'une activiti dans une region francophone
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]