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

Funny to see stack allocation mentioned as C++ strong feature, when so many languages offer it.

Maybe this is a side effect of scripting languages and VM implementations going mainstream.



Please, be direct with your criticisms of me rather than just implying them.

What other commonly used languages offer pointerlessness to the same degree as C++? Rust, for sure. Not C as there are no generics, making allocations + void* and simplistic data structures like linked lists more common than necessary. Maybe D but AIUI there is some struct/class difference that forces GC allocation for classes. What else?

(Also, please read my original comment properly, I was not just talking about "stack allocation".)


I am just answering about placing data into the stack, and that is offered by all descendents of Algol/Pascal/CLU/Mesa/Modula/Ada/... family of languages.

You can place data in the stack in all of them.

Quite a few of them allow for generics, starting with CLU.

Ada also offers RAII, although a bit more verbose than C++ way of doing it.

All of them allow reference arguments, hence no need for pointers for output parameters.


RAII is totally irrelevant to this discussion, and I clearly said I was not just talking about placing data on the stack.

> All of them allow reference arguments, hence no need for pointers for output parameters.

I wasn't very clear, the use of a C-style pointer is irrelevant: if it is being used as a reference (i.e. not owning, no need for clean-up/deallocation), then it counts as a reference. I was using the Rust terminology where 'pointer' mostly refers to 'smart pointer'.




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

Search: