Fixing C's Biggest Mistake
areYouSureAboutThat
areYouSureAboutThat at gmail.com
Thu Jan 5 22:35:37 UTC 2023
On Thursday, 5 January 2023 at 22:09:15 UTC, H. S. Teoh wrote:
>
> `int[]` is a slice. The static array is written as `int[2]`.
>
> This is valid (though not exactly a good idea):
>
> // Take a slice of a static array
> int[] myStaticArray = [0, 1].staticArray[];
>
>
> T
to be honest, I've never needed a static array in D.
I just let the gc take care of everything with []
so I'll leave the 'controversy' over this to those that do ;-)
in the meantime.. this is hardly .. hard:
auto myStaticArray = [0, 1].staticArray;
int[2] myStaticArray = [0, 1].staticArray;
people can still count.. can't they?
More information about the Digitalmars-d
mailing list