Topic: pointer to element of member ?


Author: ron@sensor.com ("Ron Natalie")
Date: Thu, 8 May 2003 21:08:08 +0000 (UTC)
Raw View
"Gianni Mariani" <gi2nospam@mariani.ws> wrote in message news:b9e7q6$4pa@dispatch.concentric.net...

>          char Zoo::*             pp2 = & Zoo::x[3]; // << is this legal ?

Nope.

>
> If not, I submit a proposal to make it legal.
>
>
Well, it might get dicey if the submember is a virtual function.



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: gi2nospam@mariani.ws (Gianni Mariani)
Date: Thu, 8 May 2003 18:58:02 +0000 (UTC)
Raw View
Is it legal C++ to take a pointer to element of member ?

If not, I submit a proposal to make it legal.

class Zoo {
         public:

         char            x[11];
         char            y;
};


int main()
{
         char Zoo::*             pp1 = & Zoo::y;

         char Zoo::*             pp2 = & Zoo::x[3]; // << is this legal ?

         return 0;
}


While I'm at it :


 char ( Zoo::* pp4 )[11] = & Zoo::x; // this IS ok AFAICT

should the following be legal C++ ?

 char Zoo::* pp5 = & pp4[ 3 ]; // << is this legal ?


If not, I submit a proposal to make it legal.


Thanks

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]