public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* static class declaration
@ 2004-01-02  4:11 He HongFu
  0 siblings, 0 replies; 4+ messages in thread
From: He HongFu @ 2004-01-02  4:11 UTC (permalink / raw)
  To: gcc-help-list

Hi:
	I want to know the meaning of declaration a class with static following:

	static class Foo 
	{
		//...
	}

	Which is do well with MSVC compiler, but G++ cannot compile it.

	Thanks in advance!
				
													He HongFu



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: static class declaration
  2004-01-08 13:29 ` Andrea 'Fyre Wyzard' Bocci
@ 2004-01-08 14:51   ` Rupert Wood
  0 siblings, 0 replies; 4+ messages in thread
From: Rupert Wood @ 2004-01-08 14:51 UTC (permalink / raw)
  To: 'He HongFu', 'Andrea 'Fyre Wyzard' Bocci'
  Cc: gcc-help

> I don't know if you can have a static class. You do can have a class
> with static members...

Or you can define class and a static instance of it at the same time, e.g.

       static class foo
       {
           foo() {}
       } bar;

which is equivalent to:

       class foo
       {
           foo() {}
       };
       static foo bar;

i.e. the static belongs to the declaration of the variable and not the
class.


The case you originally asked about, static class but no variable, will
compile with MSVC but *does* generate a warning. g++ generates an error.
They're just reacting differently to invalid code.

Rup.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: static class declaration
       [not found] <3FE2CE3D0040B8E9@ims6a.libero.it>
@ 2004-01-08 13:29 ` Andrea 'Fyre Wyzard' Bocci
  2004-01-08 14:51   ` Rupert Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2004-01-08 13:29 UTC (permalink / raw)
  To: He HongFu, gcc-help-list

I don't know if you can have a static class. You do can have a class with 
static members...

.fw.


At 12:06 02/01/2004 (GMT -0800), He HongFu wrote:
>Hi:
>         I want to know the meaning of declaration a class with static 
> following:
>
>         static class Foo
>         {
>                 //...
>         }
>
>         Which is do well with MSVC compiler, but G++ cannot compile it.
>
>         Thanks in advance!
>
> 
>He HongFu


^ permalink raw reply	[flat|nested] 4+ messages in thread

* static class declaration
@ 2004-01-02  4:11 He HongFu
  0 siblings, 0 replies; 4+ messages in thread
From: He HongFu @ 2004-01-02  4:11 UTC (permalink / raw)
  To: gcc-help-list

Hi:
	I want to know the meaning of declaration a class with static following:

	static class Foo 
	{
		//...
	}

	Which is do well with MSVC compiler, but G++ cannot compile it.

	Thanks in advance!
				
													He HongFu



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-08 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-02  4:11 static class declaration He HongFu
2004-01-02  4:11 He HongFu
     [not found] <3FE2CE3D0040B8E9@ims6a.libero.it>
2004-01-08 13:29 ` Andrea 'Fyre Wyzard' Bocci
2004-01-08 14:51   ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).