Hacker News new | past | comments | ask | show | jobs | submit login

That isn't weird. At all. The language did precisely what the programmer asked it to. When you make a language operate closely to the metal, you can expect the syntax to be more abstruse. If this kind of mistake was possible in a higher level language, I would expect that to be a language pitfall.



"When you make a language operate closely to the metal, you can expect the syntax to be more abstruse"

It's the exact opposite. Close-to-the-metal, the syntax is actually very friendly - you've got values, and you can bash them in like a half-dozen ways. C is incredibly simple (I suppose their pointer syntax is a little janky, but one can always express it "one level at a time" via typedefs).

The really complicated parts come from making high-level operations seem "easy". There is no close-to-the-metal notion of char* vs a string, or a lvalue vs an rvalue, let alone template metaprogramming.


What I should have said was provide high level abstractions while still allowing low level operations. There is an impedance mismatch that the language needs to address. Languages like Rust can get away with this by not allowing the most low level operations that are deemed unsafe and so have a more user friendly api. C on the other hand, makes no attempts at make the abstraction so the syntax is just small by definition.


You really don't think that the semantics of foo[5] = {0} vs int foo[5] = {0} being completely different in C++11 is weird?


They read differently so why shouldn't they be different? One has a type specification so reads like a declaration. The other doesn't. This wasn't weird before C++11 too. The only difference is that one didn't compile before (prior to the introduction of initializer lists).


Wow, C++ apologists really are persistent.




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

Search: