r/ProgrammerHumor • • Jul 20 '18

Every Time

Post image
52.2k Upvotes

749 comments sorted by

View all comments

Show parent comments

10

u/Astrokiwi Jul 20 '18

Sometimes it's things like uninitialized variables in C, where the behaviour of the code depends on what happened to be in some arbitrary point in memory before the program ran.

Or it could be a race condition that only happens when two processors just happen to open the same cell of the same array (of a billion cells) at the same time.

4

u/[deleted] Jul 20 '18

Thank you for the reminder.

I usually only work in C/C++ when doing embedded stuff and am probably saved by the intelligence of the compiler more often than not =D

2

u/ikbenlike Jul 20 '18

Yeah, I do basically all my programming in C and -Wall and -Werror have saved me a lot of times by now

Edit: I forgot two words

2

u/_Fibbles_ Jul 20 '18

Simultaneous reading of data is not a race condition. Simultaneous read and write or write and write is however.

0

u/as-opposed-to Jul 20 '18

As opposed to?