Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Weird C++ Function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Turochek
Newbie cheater
Reputation: 0

Joined: 20 May 2007
Posts: 13

PostPosted: Mon May 28, 2007 6:48 pm    Post subject: Weird C++ Function Reply with quote

Does this make sense to you guys? In my book it says that if you declare a variable as an integer constant, and you need it to be stored as a long, you can force and integer constant to be stored as a long by placing the letter L at the end of the number...

like this:

1337L

My question is, why wouldn't you just declare the variable as a long in the first place?
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Mon May 28, 2007 7:06 pm    Post subject: Reply with quote

Hmm.... can't think of a better example right now.... but here's one case where you might need it:

You have 2 functions overloaded with different signatures:
Code:

void kill (int in);
void kill (long in);


Although having the same name, your two functions perform completely different tasks.

Now, let's say you want to call the long function with a constant. You now could do kill(123L) instead of declaring a long variable then pass that in.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites