4 ms·
By not using them like in C. Of course this isn't an argument, but this shows that even though C++ doesn't prevent you from falling into the same trap that are
by Ragnarork 12y ago
By not using them like in C.
Of course this isn't an argument, but this shows that even though C++ doesn't prevent you from falling into the same trap that are present in C, it does give you the tool to at least allow you to do better than C to avoid these traps, notably thanks to RAII.
Oh and let's not forget nullptr, which is a blessing compared to NULL.
Pointers are still a feature of both languages.
Pointers in C++ are basically the same than in C, just with mechanisms that solve the ownership and some safety problems.
So yes, it allows the same holes, but at least you have tools to avoid falling in them.
- throwawayaway 12y agoYou need to understand so much about C to even talk about pointers in C++, and everything related to them, it's not funny. RAII -> Why? nullptr vs. NULL -> Why? Pointers -> Why? Don't use them in a certain way -> Why? The answer in all cases is C.
- pjmlp 12y agoNo, they are C++ pointers. There are endless languages that have pointers, no need to talk anything about C.
- coldtea 12y ago>The answer in all cases is C. Starting to sound like a broken record. No, the answer in all cases can also be found in C++, and understood in C++ terms alone. C++ is a SUPERSET of C, not just an arbitrary language + C.
- throwawayaway 12y agocheers for the broken record warning. i will now abstain from further conversation - i will leave you with this - i don't care to read your answer in case i have to respond and you might have to deal with some more repetition: using the language of sets, the set of C++ minus the set of C, with what is now left: how can you explain the things i have listed?
- deleted 12y ago[deleted]
- coldtea 12y ago>how can you explain the things i have listed? As evolution within the same language. Inconsistent ideas ironed out for more uniform and safer handling. A lot of used languages have similar historical warts... How do you explain "var" in JS, when "let" exists?