Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@vukdev not only that. ++i return the value of i after increment, and i++ return the value before the incrememt
-
vukdev1426y@devTea ++i will increment the value of i, and then return the incremented value and i++ will increment the value of i, but return the original value
-
Ok this is strange tbh, I mean returns a copy, but that helps for embedded systems where every byte counts
-
i would be surprised if the compiler wouldn't optimized this and even directly stripped out the return value if not needed.
To @gitpush: In embedded systems where every byte counts you are gonna use assembly! No need to include all of that libc bloat! (even tho you can probably somehow compile without it) -
@gitreflog tbh I'm not an embedded system dev nor I have info about it, but you have a point in what you said also about the part where compiler strips out non needed return value, though imo it is good for people to know the difference till that much and not like ++i adds then return and i++ return then add
-
Awlex182756yI wanted to point out the folliwing:
++i != i++
But then I realized that actually false -
@gitreflog Embedded compiling without libc is easy - just don't use its functions.
But assembly is gone in embedded, there is enough memory for C. The dev times are much shorter, that's why.
Related Rants
-
highonsleep27Frontend Dev: That's not possible in Frontend, we should do it in Backend. Backend Dev: That's not possible i...
-
kmccmk914Her: What's source control? Me: Explain Her: Why do we need that? I don't see a purpose
-
marcorodnav15Friend: Atom Me: Vs Code Friend: Light theme Me: Dark theme Friend: I believe there's some kind of energy th...
Me: ++i;
Friend: i++;
Sad story 😂
rant
wk112