4 ms·
> Write C code. Compile with C++ compiler. What C only compiler were you thinking of? Most of the ones I can think of are toy compilers. If you're making a gam
by slacka 7y ago
> Write C code. Compile with C++ compiler.
What C only compiler were you thinking of? Most of the ones I can think of are toy compilers. If you're making a game, you're going to be using clang/MSVC/gcc.
For catching bugs early, at least as important as the compiler are
* Enabling additional compiler warnings and -Werror
* Checking for memory leaks with valgrind
* checking for Undefined Behavior with UBSan
* Using mix of static code analysis tools such as Coverity, PVS-Studio, and the Clang Static Analyzer
- ssalazar 7y agoAll of those compiler families have separate C and C++ compilers. They’re saying to use g++ to compile your .c’s instead of gcc.
- slacka 7y agoAssuming OP is correct, I learned something new today. I knew running g++ on .c would produce different results based on differences in the language like sizeof('x') and differences in extern. A quick google didn't turn up any differences between warnings between g++ and gcc. I'll have to look into this.