Skip to main content
gamedev.net
🔒 Locked

Check Out This Awesome C++ Lesson

Started by Beem 23 replies 4k views
Original Post
Beem
Beem
I taught my friend C++ over Steam chat, here's how it went.. Enjoy.

5:37 PM - Jack: Also you need to put semicolons all over the place.
5:37 PM - Jack: There's not much ryhme or reason as to where you put them, but trsut me, you need them.
5:39 PM - Scamster: smile.png
5:40 PM - Jack: Whenever some comes to me and says their game is broekn, I tell them it's probably a semicolon, and it almost always is.
5:40 PM - Jack: No why I say there is no rhym or reason is because...
5:40 PM - Jack: class SomeClas { }; <= needs semicolon
5:40 PM - Jack: but
5:41 PM - Jack: namespace SomeNamesapce {} <= doesn't ened semicolon.
5:41 PM - Jack: And...
5:41 PM - Jack: switch(somevalue){} <= doesn't need semicolon.
5:41 PM - Jack: but.
5:41 PM - Jack: enum SOMENUM{}; <= needs semicolon.
5:41 PM - Jack: Also
5:41 PM - Jack: for(int i=0; i<3; i++){} <= has semicolons in weird places, but doesn't need one at the end.
5:42 PM - Jack: What's alright though is if you add a semicolon where you don't need one, in many cases it's okay.
5:42 PM - Jack: not the namespace one thugh.
Alan Greenspan
Alan Greenspan

[quote name='Alan Greenspan' timestamp='1353631940' post='5003349']
Wow. You're funny. Not.

Wow. You're funny. Not.

@OP: I appreciated it smile.png
[/quote]

You've got to be kidding me, this sounds like a joke some tween who just started learning C++ made to his friend who knows nothing about programming.
Cornstalks
Cornstalks

[quote name='Cornstalks' timestamp='1353632933' post='5003350']
[quote name='Alan Greenspan' timestamp='1353631940' post='5003349']
Wow. You're funny. Not.

Wow. You're funny. Not.

@OP: I appreciated it smile.png
[/quote]

You've got to be kidding me, this sounds like a joke some tween who just started learning C++ made to his friend who knows nothing about programming.
[/quote]
I have a decent response for that, but I'm not going to feed the troll. It just sucks you have to be a kill joy on this site.
RLS0812
RLS0812
Killing joy is my job here: angry.png

In responce to OP - Interesting topic, but I fail to see the humor in the post
I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me. ~ Ralph Waldo Emerson
Bacterius
Bacterius
It's not really funny (at least to me, and I know a bit of C++) because semicolons in C++ actually have do a rhyme and reason to them, except perhaps the namespace one. But that's just my opinion, no one else's and unlike the (now banned) member above, I do not draw unwarranted conclusions from it.
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
slicer4ever
slicer4ever
not really sure what the OP is attempting to do here, humor seems to be the objective, but i personally don't really see any here...and truly hope he's not being sincere.
way2lazy2care
way2lazy2care
I smiled and then remembered it was morning. It's generally much better advice than any advice I would have given when I was starting ("Just keep trying to turn all the *s into &s or ->s until it compiles").
SymLinked
SymLinked

5:40 PM - Jack: Whenever some comes to me and says their game is broekn, I tell them it's probably a semicolon, and it almost always is.


Like that would break their game. It won't even compile.
Not funny. rolleyes.gif
Madhed
Madhed

5:40 PM - Jack: Whenever some comes to me and says their game is broekn, I tell them it's probably a semicolon, and it almost always is.


im hertbroekn

tongue.png
Servant of the Lord
Servant of the Lord

Killing joy is my job here: angry.png

That's very hard to do when you have an utterly adorable red fox as your avatar. happy.png
RLS0812
RLS0812

[quote name='Shippou' timestamp='1353648061' post='5003381']
Killing joy is my job here: angry.png

That's very hard to do when you have an utterly adorable red fox as your avatar. happy.png
[/quote]
I need a more menacing avatar ....
I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me. ~ Ralph Waldo Emerson
L. Spiro
L. Spiro

I need a more menacing avatar ....

Rawr.

Consider yourself avatar-menaced.

What I find funniest about this topic is that Alan Greenspan was banned. Was it because of this topic or was there another topic somewhere where a moderator told him off before banning? Can’t view his profile to check his posts to find it.


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Cornstalks
Cornstalks

What I find funniest about this topic is that Alan Greenspan was banned. Was it because of this topic or was there another topic somewhere where a moderator told him off before banning? Can’t view his profile to check his posts to find it.

He was a GameDev troll who's been around before. Thread 1. Thread 2. Thread 3 (likely him). Thread 4 (his post was deleted in this one, but it's been quoted). etc. These are just the ones I can find with a quick google. I don't know if there were any private messages or stuff, though.

I'm surprised this thread went the way it did and didn't turn into something like this... But I've not been disappointed.
ApochPiQ
ApochPiQ
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.)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.