Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What's wrong with C++?

Name: Anonymous 2014-01-18 22:19

What's wrong with C++ and where does the name sepples comes from anyway? I mean apart from the sometimes fucked up syntax rules.

Name: Anonymous 2017-01-06 2:11

This is probably a retarded question, but what exactly is the point of having namespaces in C++? Since the language allows nested classes and structs, why can't you just use classes/structs with static member functions, or unique global objects, to organize functions and control name visibility? That's how all the other OOP languages handle it. And especially considering that classes also function as namespaces, but the reverse isn't true.

Really the only advantage namespacees have right now is the using statement, but the language could easily be designed to have that apply to classes instead. So instead of saying using namespace std; or std::cout, you'd say something like import std; or std.cout. It seems it would clean up the syntax quite a bit. If there's some optimization-related reason that namespaces are more efficient since the compiler knows they can't be instantiated as an object, couldn't the same be achieved by declaring a class as static class std {};? That would tell the compiler that the class contains only static members and will never be instantiated (and will result in a compile-time error if we violate that constraint). It just seems to me that namespaces just end up complicating the syntax when another already-existent language feature could do the same thing just as well.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List