5 ms·
IMO lack of initialization in a language should be explicit, not implicit, e.g. DLang: import std.array : uninitializedArray; int a;
by unsignedqword 10y ago
IMO lack of initialization in a language should be explicit, not implicit, e.g. DLang:
import std.array : uninitializedArray;
int a; /+ defaults to '0' +/
int b = void; /+ not initialized +/
bool[5] c; /+ defaults to array of 'false' +/
auto d = uninitializedArray!(bool[])(5); /+ not initialized +/
- hellofunk 10y agoI agree. In Swift, an uninitialized variable must be set to nil and have the properties of an optional for it to compile. Not a bad idea. Using 'auto' in C++ forces out uninitialized variables as well.