Re:The C23 edition of Modern C is now available for free
by Quekid5 on Tuesday October 15, 2024 @03:52PM
(#41852443)
I've seen either style, but it the argument about which is proper is pointless. Any modern compiler will optimize either equally well, unless you're doing something that actually depends on the order of the increment.
[ Parent
| on HN ]
Re:The C23 edition of Modern C is now available for free
by kanbankaren on Tuesday October 15, 2024 @04:14PM
(#41852642)
No, for fundamental datatypes pre/post-increment doesn't matter, but for classes that overload those operators, the postfix form creates a temporary object hence people write
for(auto it = begin(v); it != end(v); ++it)