Hacker News new | past | comments | ask | show | jobs | submit login

Yes, it is possible, specially if you adopt modern idioms.

- Never use C style strings or arrays directly.

- Prefer STL data structures for memory management (unique_ptr , shared_ptr and others)

- Don't use C style enums (class enums are type safe)

- Don't use C casts

- When dealing with C libraries, always wrap them in safe C++ wrappers with safety invariants

- Always enable bounds checking for vectors, strings and iterators on debug builds.

- Always use references for pointer parameters that aren't supposed to be null

- Make effective use of RAII

Basically all boils down to don't program in C++ as if it was C with extras.




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

Search: