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

> You can bound-check your arrays at run-time, by wrapping them in a struct and only accessing them with functions.

This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science.

You are no longer using arrays, but a data structure made by yourself.

> There's even a proper (although conservative) garbage collector for C, while C++ usually boils down to reference counting.

If you are referering to Boehm-Demers-Weiser GC, it also works in C++.

C++11 also has a GC API.

> Even in C you are not restricted to the standard library to handle strings. C doesn't have to mean null-terminated strings.

The moment you do this, you are the strange kind in town as all libraries expect C style strings as input. So it is conversion party any time you need to call those functions.

> (And in C++, too, string literals give you the old-time bad strings.)

Yeah, this is a consequence of C's compatibility that infected C++.



> This is no longer a data type seen as a language type, but an Abstract Data Type as known in Computer Science.

Yes, it's no longer a built-in data type. But non-builtin-types are perfectly fine, too. By the way, how do you get bounds checking in C++? I guess you use the same technique, but C++'s overloading makes it syntactically easier to hide that you are not using a built-in?


Yes, but that minor difference makes a huge difference in usability.

Thankfully C++ is powerful enough that user types have the same rights as built-in ones.




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

Search: