logoalt Hacker News

Veservtoday at 10:40 PM1 replyview on HN

Pointer to array is not only type-safe, it is also objectively correct and should have always been the syntax used when passing in the address of a known, fixed size array. This is all a artifact of C automatically decaying arrays to pointers in argument lists when a array argument should have always meant passing a array by value; then this syntax would have been the only way to pass in the address of a array and we would not have these warts. Automatic decaying is truly one of the worst actual design mistakes of the language (i.e. a error even when it was designed, not the failure to adopt new innovations).


Replies

jacquesmtoday at 10:44 PM

Fully agreed, and something that is hard to fix. This guy is trying really hard and with some success:

https://news.ycombinator.com/item?id=45735877

show 1 reply