Does your game oppress minorities? You are making games, right?
(media.scored.co)
You're viewing a single comment thread. View all comments, or full comment thread.
Comments (21)
sorted by:
I had to rewrite this. I think static objects initialized to 0 or uninitialized get allocated to global space that the OS or the C runtime is obligated to zero.
That's why I declare enums without a valid 0 value. There is basically no cost to doing so.
That's actually a good idea. I'm going to adopt that for non-flags enumerations.
For flags, you can use a valid bit so an uninitialized 0 value still reads as invalid.
bool * isFemale = (bool*)malloc(sizeof(isFemale));
Its been 10+ years since I took a C course. If I recall correctly malloc() initializes to garbage memory values, calloc() initializes to 0 by default.