Hacker News new | ask | show | jobs
by to3m 3820 days ago
When you replace the initialiser with 1, it should only initialse the first element to 1. Objects initialized in this way have unmentioned elements set to 0 or NULL (recursing into aggregates, initialising the first named union member). (See C11 standard, 6.7.9.21. 6.7.9.10 gives the rules for selecting the default value. Aside from the extra syntax, I don't think the rules differ substantially from C89...)

C++ lets you do "uint32_t array[10]={}", which is something C should allow as well, really. But it doesn't.