-
March 2nd, 2011, 04:06 PM
#1
A question about integers
Will
Code:
int i = 10000000;
i++;
take more time to process than
?
-
March 2nd, 2011, 04:15 PM
#2
Re: A question about integers
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
March 3rd, 2011, 07:42 AM
#3
Re: A question about integers
They will both compile down to
Code:
push 1000000
inc [%%sp]
and
-
March 3rd, 2011, 08:05 AM
#4
Re: A question about integers
Originally Posted by ninja9578
They will both compile down to
Code:
push 1000000
inc [%%sp]
and
or
and
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
-
March 3rd, 2011, 09:00 AM
#5
Re: A question about integers
IMO both your assembly variants are unlikely. The OP's code shows no reason to push the int at all because it's not going to be passed as a function parameter.
I'd say discussing assembly details here is moot anyway and not really helpful to the OP...
EDIT: Ok, I need to take back my statement about no need to push the int as the variable is just being constructed. Looks like I wrote the post too quickly. But the second paragraph still holds true IMO...
Last edited by Eri523; March 3rd, 2011 at 09:07 AM.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
March 3rd, 2011, 09:11 AM
#6
Re: A question about integers
Originally Posted by monarch_dodra
Probably not on -O0
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
|