Remix.run Logo
▲ vbezhenar 2 hours ago

That's huge performance loss. Imagine doing useless initialization of multi-megabyte chunk of memory. Not acceptable for C programs.

In fact I hate that C mandates static variables being initialized to zero. This is dumb. When I'm writing for MCU, that's useless cycles spent at the power on. Thankfully it's possible to fix with linker tricks, but it should not be an issue in the first place.

▲afdbcreid 39 minutes ago | parent | next [-]

I agree it is, and like the other commenter said even C++ only did it for some things. I was only saying it is not breaking.

▲aw1621107 an hour ago | parent | prev [-]

In the case of C++ initialization is (currently) only done for automatic variables, so you're not likely to be zero-initializing multiple megabytes of stack. There's also [[indeterminate]] for opting out of initialization, though that has to be done per variable.