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

> I always think C/C++ is not a good first language to teach, because you need to understand some general concepts about computer systems before diving in.

Some believe that it's important to teach those things about computer systems first. To anyone who knows how the machine works it's pretty obvious why a primitive stack variable is uninitialized: initializing them would cost a store which would in most cases be pointless. People use C and C++ because they want all of the performance the machine has to offer, and usually more. Stuffing the program full of immediate value loads and stores would make it huge and slow. C++ is already cursed with enough pointless stores, for example initializing the buffer of a string just after resize and just before copying something else into the same memory. We don't need more of these things.

The author then goes on to complain at length about {} initializers in C++11, which everyone recognizes as problematic, and which has been partially fixed in C++14. This has basically nothing to do with the first part of the article.



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

Search: