Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Reeks of an anti-C bias. This comment by the author is flat out wrong, and I quote:

""" `int x[1000]` in C or C++ doesn’t have much meaning. It’s semantically equivalent to declaring “x” as `int *x`. You can reassign X any time you want, to make it point to a different location. """

C is also a pretty different language style-wise than C++. Aside from that, they're both good languages for building runtimes since their memory model resembles physical memory and they can run in an unhosted (runtime-less) environment.

Just a childish rant really.



Obviously, the OP was talking about function parameters, where "int x[1000]" is semantically equivalent to "int *x", see C11, 6.9.1, item 10:

http://www.iso-9899.info/n1570.html#6.9.1


It's not obvious what he was talking about. In context he was responding to this comment:

"While I know that C compilers are really conservative about this, doesn’t it matter as to how x and y are declared? After all if they are dclared as: int x[1000], y[1000];"

Those array declarations aren't function argument declarations (except in pre-C89), so not sure why he would talk about semantic equivalence in response to that if it only applies to function arguments.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: