>>1
First of all, it should be called ++C, except that nowadays It's more like C-=10. Secondly, I would think that the compiler would take care of any optimising any uses of ++i and i++ appropriately and that worrying about such a micro-optimisation (if it ever was) is stupid.
It's the oldest troll in the book. Get kids that dig micro-efficiency to spend hours going through their code changing all post to pre, without realizing the compiler does this for them.
(Chorus)
Hey hey, you you, I don’t like your girlfriend
No way, no way, I think you need a cow one
Hey hey, moo moo, I could be your girlfriend
Hey hey, you you, I know that you like cows
No way, no way, no it’s not a secret
Hey hey, moo moo, I want to be your cow-girl
Milk’s so fine, and you want mine, it’s so delicious
You want to milk me all the time, it’s so addictive
Don’t you know what I can do to make you drink all night?
Don’t pretend, I think you know I’m lactating
And hell yeah, sure my titties are milk-making
I can tell you like ‘em too, and you know I’m right
She’s like, so flat-chested
Her breasts are so untested
I think we should get to milking now
And that’s what everyone’s talking about
(Chorus)
I can see the way, I can see the way you look at tits
And even when you look away, I know you think of tits
I know you wank over me all the time again and again (and again and again and again)
So come over here and hook me to the milk machine
Or better yet, hand-milk ‘em (cause it’s fresh and clean)
I don’t wanna hear you try to fight this urge again (not again, not again, not again)
Because...
She’s like, so flat-chested
Her breasts are so untested
I think we should get to milking now
And that’s what everyone’s talking about
(Chorus)
In a second, hands are wrapped around my nipples
‘Cause milking, milking’s so much better
There’s no other, so when will you start drinking
She’s no cow-girl, what the hell were you thinking?
In a second, hands are wrapped around my nipples
‘Cause milking, milking’s so much better
There’s no other, so when will you start drinking
She’s no cow-girl, what the hell were you thinking?
>>20
I think >>19 just translated >>18's line into Lisp as an example. It looks correct: the first line increments x, the second line saves the value of x to be returned from the expression, and then increments x once again, which is the same as C's ++x++. Purely functional programming has nothing to do with this thread, and most Lispers will write side-effecting code when it makes sense to do so. Even if >>19's code is side-effecting, it's still returning a value, which doesn't make it non-functional, it just makes it side-effecting.
And if I was >>19, I would have just written (prog2 (incf x) x (incf x)) instead
Name:
192009-10-12 13:08
>>21
No, I'm not translating >>18's anything. OP posted some crap about post increment/decrement being dangerous. I posted the versions of post/pre incrementation in lisp, pointing out the infallability of these forms, thus, thread over.
If I were to translate >>18, first I'd have to give my own meaning to ++i++ since it's undefined behavior in both C and that other language; secondly, if we assume it to be what you provided, then I'd write the code as:
(prog1 #1=(incf x) #1#)
Or
(1- (incf x 2))
Name:
Anonymous2009-10-12 13:49
>>23
have you learned absolutely nothing about functional programming
Name:
Anonymous2009-10-12 14:12
>>24
Like what in particular do you have in mind? Care to explain why you're bawing about functional programming when the expression with which this discussion spawned is state-changing?
C++: Where artifacts of the language dictate how you write your code. Because properly designing things is harder than throwing random shit together and see if it works out.
>>33
I was thinking that if the loop variable is stored in some register for the duration of the loop, then in terms of CPU cycles, it doesn't matter if you increment the register before or after whatever operation requires the value of the loop variable. (In this case, the mov was just an example of such an operation).
Of course in the example you wrote, the former case would take more CPU cycles than the latter. But then again, if your loop has so many statements that you don't have a spare register in which to store your loop variable, the efficiency of pre/postdecrement is insignificant.
Name:
Anonymous2009-10-13 11:39
They aren't always the same, with CPU pipelining etc.