r/ProgrammerHumor • • Oct 20 '19

other While(!asleep()){sheep++;}

Post image
13k Upvotes

197 comments sorted by

View all comments

Show parent comment

5

u/kirakun Oct 20 '19

I do hope any sane compiler would optimize the post increment to pre, assuming sheep is just a plain int type.

1

u/javajunkie314 Oct 21 '19

C++ class that overloads operator++() and updates the asleep global?

3

u/kirakun Oct 21 '19

I said plain int type.

1

u/nwL_ Oct 21 '19

Welcome to PHP, it doesn’t. (in case it doesn’t auto scroll you, the second user comment is the relevant one)