Posted: Mon May 28, 2007 6:48 pm Post subject: Weird C++ Function
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?
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?
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