You are in a C/C++ file. You declare a (C/POD) static variable at the :: level (not inside of a function. Because it is static, under the C standard you know that it will be auto-initialized to the type's 0 value. And in the semantics of your program, this variable *should* be initialized to zero. So you:
Provide no initializer, since it defaults 0
8.6%
Type "= 0" or "= false" anyway, for readability
82.1%
Andi what the fuck are you talking about
9.3%
Poll ended at .
Note: I acknowledge that this question is invalid, due to unclosed parenthesis on line 1:70
@mcc Thank you, I thought my parser was glitching
@mcc I read this in strongbad's voice.
@mcc the initializer also makes the code more resilient to refactoring into context where default 0 isn't standard
@luci @mcc exactly this. Code copying leads to so many bugs due to no-longer-correct assumptions.
@mcc always make your intent clear so the compiler has a chance to optimize. Also prevents compiler bugs from surprising you.
@RoyAwesome @mcc Give the linker a chance to pessimize, fill the rdata segment with hardcoded zeroes. šŸ˜‰

@mcc Ooh, I love interactive fiction!

> provide no initializer

You have been eaten by a grue.

@mcc Do you care about padding bits?
@mcc "under the C standard you know" ... do I?!? I'm not certain I do. I'm pretty sure I have doubts and so I'm typing "= 0" not because of high-falutin readability concerns but because of fear of the unknown.
@gregtitus this is an extremely fair point, but for purposes of this question you are role-playing a person who has recently checked the relevant c/c++ standard and verified this to be the case. (however we may still count your reply as a "type it for readability" because even if you have checked the standard and know this, you must assume your coworkers/collaborators have not)
@mcc @gregtitus Role playing someone who read the standard, I add it anyway because I still don't know what the compiler will do. I can check today, but what about tomorrow?
@mcc I once worked on embedded firmware that had a bug where it didn’t initialize BSS. Until this was fixed, every global variable had an initializer. šŸ˜…
@bk1e :squeaks: no… no!
@mcc I live in the auto-initialized variable. The value shall be initialized to me
@mcc is this one of those horrifying situations where C++ does something different from C?
@phessler No, not this time. Although obviously [C++ types with initializers in C++] may behave different from [C types in C++].
@mcc explicitly set. in fact I do exactly that in Java, if the initial value is significant. (ie: isn’t certain to be set elsewhere before it would be used.) ditto instance vars.
@mcc The correct response is to panic and initialise it in a function anyway. Because anybody who believes compiler/language rules in C++ is cruising for a bruising.
@TomF @mcc going to be a bit messy when they are static const
@oblomov @mcc Those don't have storage.

@TomF @mcc

doh, I should stop replying to tech threads at 7am

@TomF @oblomov @mcc
unless their address is taken.
@mcc depends. If everything is going to be zero, I'll just trust the compiler to follow the standard. If other nearby values need to be initialized to something different than 0, I'll do the explicit thing for the null values.
@mcc I type as little as possible and wait for the compiler error to tell me what I should do.
@mcc I think someone could create C++ with the benefit of hindsight and make it a great language. There's probably library shelves worth of writing about why and how C++ is flawed, who could ask for better user research?
@fabiosantoscode that might just be C#. Whether it's great can be a matter of opinion.
@mcc I find it way more tolerable than C at least
@fabiosantoscode I would describe C# as "Pretty good!"
@mcc static outside of a function means something completely different and is just a global variable that is not linkable. And I would use `= {};` in C++ and C23
@mcc Definitely explicit initialization in most languages. My personal exception is go, which has super consistent zero value behavior for all types and all declarations, which I acknowledge is complete vibes-based

@mcc C spec concerns aside, I just dislike when people do things like that anyway, because if I’m reading or reviewing the code it makes me have to think about their intent

code is language and language is about communication; if you don’t communicate your intent, you aren’t effectively using it, even if you think it’s more ā€œelegantā€

(note I would also take a comment, if it’s some sort of situation where the default value can change and you want this to always be the default, because ā€œ// initializes to the default value (currently 0)ā€ also communicates intent well)