3 ms·
Well, had C been really strongly-typed then the hypothetical 'int[5]' and 'int[7]' would have been different types, and 'int[]' would be the size-agnostic type
by unscaled 10y ago
Well, had C been really strongly-typed then the hypothetical 'int[5]' and 'int[7]' would have been different types, and 'int[]' would be the size-agnostic type for an array.
Then you could easily get creature comforts such as:
typedef uint8_t[16] guid_t;
typedef uint8_t[20] sha1_digest_t;
These typedefs would then have copy assignment, pass-by-value semantics and everything else you'd expect from value types.
- ssalazar 10y ago> Then you could easily get creature comforts such as: > typedef uint8_t[16] guid_t; > typedef uint8_t[20] sha1_digest_t; > These typedefs would then have copy assignment, pass-by-value semantics and everything else you'd expect from value types. What does this accomplish that a struct can't?