20 ms·
There is a concern for performance. But that's no reason. Zero initing could be default behavior that can be declared away. E.g. As a type qualifier keyword:
by kazinator 8y ago
There is a concern for performance. But that's no reason. Zero initing could be default behavior that can be declared away. E.g.
As a type qualifier keyword:
{ int x, y; /* x and y are zero */ }
{ int noinit x, y; /* x is indeterminate, y is zero */ }
Or as a declaration specifier:
{ noinit x, y; /* both x, y indeterminately-valued */ }
Or a special constant for suppressing zero initialization:
{ int x, y = noinit; /* x zero, y indeterminate */ }
Similarly, unspecified order of evaluation could be supported by explicit request:
decl (unspec_order) { /* comma-separated list of decl items */
a[i] = i++; /* UB */
}
a[i] = i++; /* well-defined */
- sam_dam_gai 8y agoGood idea!
- rurban 8y agozero initing is default behavior for static values or structs. static int x, y; /* x and y are zero */