Y
Hacker News
new
|
ask
|
show
|
jobs
by
bigfishrunning
307 days ago
what changes, in your opinion, would need to be made to the C array type to make it "sensible"? C's array is simplistic, but I don't think it's not "sensible"...
2 comments
nicoburns
307 days ago
It would need to store a length and not decay to a pointer when passed to a function.
link
mgaunard
305 days ago
the length is part of the type.
link
mgaunard
307 days ago
consider the C++ std::array, which exists to make arrays behave like normal objects.
You can do the same in C by wrapping your array in a struct.
link