>S++ or S=S+1, which can be recommended to increment the value by 1 and why?
>S++, as it is single machine instruction (INC) internally.
>not using ++S
>>56233272
That's a compiler's work.
Just write S = S + 1 in a higher language.
>>56233291
S += 1
>>56233272
>This retardation is on TWO websites
>>56233291
>not knowing the 2 are different
>>56233403
this, I like this more
I only use python though
>>56233291
best
>>56233272
Who gives a shit. Did you just learn how to program?
>S++
>single machine instruction
lmoa, in what fucking world?
>>56233272
Does this answer your question?
If S is a primitive type and you don't care for the expression value, the compiler will generate identical code for all expressions.
>>56233964
I didn't have a question...
>>56234013
There's a question mark in your post, so yeah you did ask a question.
>>56234047
I copied it from a website because it's stupid
>>56233272
The compiler should be smart enough to optimize it.
I'm NOT sure how it would handle something likewhile true
print array[i++]
though.
>>56233729
Most instruction sets include an increment instruction, which they should be able to use if the variable is already in a register.
>>56234430
why are you not sure?
>>56235944
Because I'm pretty sure most instruction sets can't read a value from an array, pass it to a function, and increment the array index in a single instruction. Incrementing a value is much simpler, taking only one instruction if it's already in a register.
>>56236819
It should do it exactly as you described. There's no way that would just be one instruction.