Topic: Definitions with :: (was: Proposal: static extensions to built-in types)
Author: Barry Margolin <barmar@bbnplanet.com>
Date: 1998/05/19 Raw View
In article <35614CFD.FEFADDCF@physik.tu-muenchen.de>,
Christopher Eltschka <celtschk@physik.tu-muenchen.de> wrote:
>Pablo Halpern wrote:
>>
>> John Hancock <jhancock+@IUS5.IUS.cs.cmu.edu> wrote:
>>
>> > And this change to the language would break no
>> >existing code, since char::foo would be illegal in today's standard.
>>
>> char::foo; defines a global variable, foo, of type char.
>
>Then what about:
>
>struct X
>{
> static int x;
>};
>
>X::x;
The difference is that "char" is a keyword in the language, and "char::foo"
is lexed as "char ::foo", which is a variable definition.
--
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Christopher Eltschka <celtschk@physik.tu-muenchen.de>
Date: 1998/05/19 Raw View
Pablo Halpern wrote:
>
> John Hancock <jhancock+@IUS5.IUS.cs.cmu.edu> wrote:
>
> > And this change to the language would break no
> >existing code, since char::foo would be illegal in today's standard.
>
> char::foo; defines a global variable, foo, of type char.
Then what about:
struct X
{
static int x;
};
X::x;
Does this
- define a global variable x of type X, or
- define the static member x of X via implicit int rule?
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]