Advertisement

Check Out This Awesome C++ Lesson

Started by November 19, 2012 01:45 AM
23 comments, last by slicer4ever 11 years, 11 months ago
There's perfect reason to the semicolon rules in C/C++.


You need a semicolon after a } any time you are working with something that can be instantiated. Otherwise, you don't.

This is to support the following syntax:

struct Foo
{
int member;
} InstanceOfFoo;

InstanceOfFoo.member = 42;



Can you instantiate structs? Check. Classes? Check. Enums? Check. Namespaces? Nope! Therefore, namespace does not need a trailing semicolon. (For that matter, functions and the bodies of code blocks follow the same pattern.)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


There's perfect reason to the semicolon rules in C/C++.


You need a semicolon after a } any time you are working with something that can be instantiated. Otherwise, you don't.

This is to support the following syntax:

struct Foo
{
int member;
} InstanceOfFoo;

InstanceOfFoo.member = 42;



Can you instantiate structs? Check. Classes? Check. Enums? Check. Namespaces? Nope! Therefore, namespace does not need a trailing semicolon. (For that matter, functions and the bodies of code blocks follow the same pattern.)

tell that do/while loop
;D

-edit-
I see now the "after }" you mentioned..
anyway I found a discussion on the do while semicolon:
http://stackoverflow.com/questions/942251/in-c-c-why-does-the-do-whileexpression-need-a-semi-colon
Advertisement
The 'Banned' status is very misleading with the strike-through, I thought it meant he was unbanned from a previous ban
[s]Red name without strikethrough is reserved for moderator names.[/s] [Edit:] Whoops, that was a previous version of the site. Ignore that.

The 'Banned' status is very misleading with the strike-through, I thought it meant he was unbanned from a previous ban

Heh, yeah, I'd vote for a strikethrough name (normal color) with red Banned tag (no strikethrough).

As for menacing avatars, I almost changed my avatar one of the frames from this to illustrate how I was feeling at the time... nothing was working ha.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

I almost changed my avatar one of the frames from this to illustrate how I was feeling at the time... nothing was working ha.


o god, that's awesome!=-)
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

This topic is closed to new replies.

Advertisement