Handmade Hero»Forums»Code
117 posts
Code hacker/developer
C++ as C
Edited by Todd on Reason: Initial post
Casey seems to basically write C but compile with C++. I want to do that same to access a few C++ features such as the std::string library (I have to work with strings a lot and that sucks in C), references, and perhaps a few others. Is there any particular gotchas I need to know about doing this? For example, if I continue to use printf and all of the other C functions rather than cin and cout and etc.... Is this "bad" or can I do that just fine? Any other tips?
511 posts
C++ as C
You can use whatever subset of C++ you feel comfortable with.

The only cost you'll need to worry about will be people complaining about your code.
117 posts
Code hacker/developer
C++ as C
ratchetfreak
The only cost you'll need to worry about will be people complaining about your code.


Gotta love those people. Luckily, they'll likely never see my code anyway since the other team members also blend C and C++, favoring C. I guess I lucked out with finding a good situation to that end.
Miles
131 posts / 4 projects
C++ as C
The major things to watch out for, in my opinion, are that 1. interactions between RAII types (like std::string) and C-style code and containers which expect everything to be a POD struct can be a minefield, and 2. certain C++ language and standard library features have a significant impact on compile times, debug performance, and code size - but you probably already knew as much.