-
January 9th, 2014, 10:04 AM
#1
Termination of namespaces with a closing brace only ...
... and not with a brace followed by a semicolon like in class-definitions - does anyone know the reason for that?
-
January 9th, 2014, 10:16 AM
#2
Re: Termination of namespaces with a closing brace only ...
That's just what the rule is, I've never thought too hard about it.
I suppose one *could* argue that a namespace is merely a scope, and like all scopes it doesn't require a closing semicolon, while a class definition is something a little different.
You really have to punt to C, though----C required structs to be followed by a semicolon, so C++ kept the same pattern with classes. That's really all there is to it.
-
January 9th, 2014, 11:35 AM
#3
Re: Termination of namespaces with a closing brace only ...
Originally Posted by greve
the reason
Maybe it is because you can declare a variable of the class right away like,
class A {
} a;
Most often you don't so almost always this is what you see,
class A {
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|