Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Is this forward declaration legal C++?

Reply
Thread Tools

Is this forward declaration legal C++?

 
 
Joost Kraaijeveld
Guest
Posts: n/a
 
      06-28-2004
Hi all,

Is this legal (including the namespace in the forward declarion):

namespace NS
{
class NS:ForwardDeclaratedClass;
};

Other file:
namespace NS
{
class ForwardDeclaratedClass
{
};
};

--
Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: http://www.velocityreviews.com/forums/(E-Mail Removed)
web: www.askesis.nl


 
Reply With Quote
 
 
 
 
Rob Williscroft
Guest
Posts: n/a
 
      06-28-2004
Joost Kraaijeveld wrote in news:a%UDc.24027$(E-Mail Removed)
in comp.lang.c++:

> Hi all,
>
> Is this legal (including the namespace in the forward declarion):
>
> namespace NS
> {
> class NS:ForwardDeclaratedClass;


class ForwardDeclaratedClass;

> };
>
> Other file:
> namespace NS
> {
> class ForwardDeclaratedClass
> {
> };
> };
>


Spurious 'NS:' aside yes.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
 
Reply With Quote
 
 
 
 
Sharad Kala
Guest
Posts: n/a
 
      06-28-2004

"Joost Kraaijeveld" <(E-Mail Removed)> wrote in message
news:a%UDc.24027$(E-Mail Removed)...
> Hi all,
>
> Is this legal (including the namespace in the forward declarion):


Couple of things wrong with your code.

> namespace NS
> {
> class NS:ForwardDeclaratedClass;

class ForwardDeclaratedClass;

> };

No semicolon here
>


> Other file:
> namespace NS
> {
> class ForwardDeclaratedClass
> {
> };


> };

No semicolon here too

>

Should be fine now.


 
Reply With Quote
 
Rob Williscroft
Guest
Posts: n/a
 
      06-28-2004
Sharad Kala wrote in news:(E-Mail Removed) in comp.lang.c++:

>
> "Joost Kraaijeveld" <(E-Mail Removed)> wrote in message
> news:a%UDc.24027$(E-Mail Removed)...
>> Hi all,
>>


>
> Couple of things wrong with your code.
>
>> namespace NS
>> {


>> };

> No semicolon here


Its a namespace not a class the semicolon isn't required.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
 
Reply With Quote
 
Sharad Kala
Guest
Posts: n/a
 
      06-28-2004

"Rob Williscroft" <(E-Mail Removed)> wrote in message
news:Xns951695C6F7676ukcoREMOVEfreenetrtw@130.133. 1.4...
> Sharad Kala wrote in news:(E-Mail Removed) in comp.lang.c++:
>
> >> namespace NS
> >> {

>
> >> };

> > No semicolon here

>
> Its a namespace not a class the semicolon isn't required.


And that's what I wrote (to drop the unnecessary semicolons), am I missing
your point?


 
Reply With Quote
 
Rob Williscroft
Guest
Posts: n/a
 
      06-28-2004
Sharad Kala wrote in news:(E-Mail Removed) in comp.lang.c++:

>
> "Rob Williscroft" <(E-Mail Removed)> wrote in message
> news:Xns951695C6F7676ukcoREMOVEfreenetrtw@130.133. 1.4...
>> Sharad Kala wrote in news:(E-Mail Removed) in
>> comp.lang.c++:
>>
>> >> namespace NS
>> >> {

>>
>> >> };
>> > No semicolon here

>>
>> Its a namespace not a class the semicolon isn't required.

>
> And that's what I wrote (to drop the unnecessary semicolons), am I
> missing your point?
>


NO . sorry for the noise.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
 
Reply With Quote
 
Howard
Guest
Posts: n/a
 
      06-28-2004

"Rob Williscroft" <(E-Mail Removed)> wrote in message
news:Xns951699F954E92ukcoREMOVEfreenetrtw@130.133. 1.4...
> Sharad Kala wrote in news:(E-Mail Removed) in comp.lang.c++:
>
> >
> > "Rob Williscroft" <(E-Mail Removed)> wrote in message
> > news:Xns951695C6F7676ukcoREMOVEfreenetrtw@130.133. 1.4...
> >> Sharad Kala wrote in news:(E-Mail Removed) in
> >> comp.lang.c++:
> >>
> >> >> namespace NS
> >> >> {
> >>
> >> >> };
> >> > No semicolon here
> >>
> >> Its a namespace not a class the semicolon isn't required.

> >
> > And that's what I wrote (to drop the unnecessary semicolons), am I
> > missing your point?
> >

>
> NO . sorry for the noise.
>


Sharad, In case you're wondering why that mistake was made, you used the
phrase "No semicolon here". That's an incomplete sentence in English, and
it can be interpreted in two different ways. Either: "There is no semicolon
here, but there should be, so you should add it.", or "No semicolon is
required or desired here, so you should remove it." He apparently thought
you meant the first, but you actually meant the second.

-Howard



 
Reply With Quote
 
Sharad Kala
Guest
Posts: n/a
 
      06-29-2004

"Howard" <(E-Mail Removed)> wrote in message
news:WGYDc.154515$(E-Mail Removed)...
>
> "Rob Williscroft" <(E-Mail Removed)> wrote in message
> news:Xns951699F954E92ukcoREMOVEfreenetrtw@130.133. 1.4...

[snip]
> > NO . sorry for the noise.
> >

>
> Sharad, In case you're wondering why that mistake was made, you used the
> phrase "No semicolon here". That's an incomplete sentence in English, and
> it can be interpreted in two different ways. Either: "There is no

semicolon
> here, but there should be, so you should add it.", or "No semicolon is
> required or desired here, so you should remove it." He apparently thought
> you meant the first, but you actually meant the second.


Howard,
I know that the sentence was incomplete. But I think that the context in
which I was talking was pretty clear. Interpreting it as "There is no
semicolon here, but there should be, so you should add it." would mean that
I have some problem in my eye sight which isn't the case actually. No
offense meant.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why re-declaration is legal in C++? Universe C++ 6 03-26-2011 11:46 AM
Is this reference declaration legal? jl_post@hotmail.com C++ 2 06-27-2008 09:05 PM
is this legal declaration/not correct output Carramba C Programming 12 07-01-2007 01:00 AM
array declaration, is this legal? b83503104@yahoo.com C++ 3 07-14-2005 09:06 AM
Re-forward declaration of types which were already forward declared qazmlp C++ 1 02-15-2004 07:00 PM



Advertisments