this post was submitted on 09 May 2024
12 points (92.9% liked)
Programmer Humor
32380 readers
425 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Perhaps *(p += 1) will be to your liking?
++p
will increase the value and return the new valuep++
will increase the value and return the old valueI think
p = p + 1
is the same asp++
and not as++p
. No?(p += 1) resolves to the value of p after the incrementation, as does ( p = p + 1).
Yes.
p++
==p+= 1
==p = p + 1
are all the same if you use it in an assignment.++p
is different if you use it in an assignment. If it's in its own line it won't make much difference.That's the point I was trying to make.
No.
++p returns incremented p.
p += 1 returns incremented p.
p = p + 1 returns incremented p.
p++ returns p before it is incremented.
Much better... but can we make it
*((void*)(p = p + 1))
?How about some JavaScript
p+=[]**[]
?