-------- Original-Nachricht -------- > Datum: Sun, 02 Aug 2009 09:03:51 -0400 > Von: John Fine <johnsfine@xxxxxxxxxxx> > An: Michael Eager <eager@xxxxxxxxxxxx> > CC: Martin Ettl <ettl.martin@xxxxxx>, gcc-help@xxxxxxxxxxx > Betreff: Re: declaration order of member variables in struct > I think Martin was asking why the usual exception to pre declaration > doesn't apply. > In defining a class or struct, you can normally use symbols before you > declare them. Exactly, this was what i was wondering. In definining a class e.g. class A { public: A():m(0){} private: double m; }; The member variable m is used before its declaration. But at the example, i wrote in my first mail, this does not work. I would be interested in why does this not work when using templates? Best regards and many thanks Martin > I don't know what makes this example different. > > Michael Eager wrote: > > Martin Ettl wrote: > >> > >> template <int N, int Low=1, int Upp=N> struct Root { > >> static const int ret = > >> Root<N,(down?Low:mean+1),(down?mean:Upp)>::ret; > > ^^^^ ^^^^ ^^^^ ^^^^ > > > > Neither down nor mean are defined before they are referenced. > > > > ... > > Each symbol (variable or type) in C/C++ must be declared before it is > > used. > > > > -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser