Re:C++11 and The Long-Term Viability Of GCC Questioned
by iso-8859-1 on Saturday January 26, 2013 @08:28PM
(#5122633)
Why not just write code for the standard? Unless you are using your own stdlib or something, it shouldn't matter much what compiler you use.
Most of the code didn't need changes, except where it handled strings (or the char *string1 type string) because somehow gets() caused a segment fault and when I switched to scanf() it worked without crashing. When I used the math.h library and the sqrt() function I had to use the -lm switch on the compiler to get it to work.
I rewrote them in C++ using the G++ compiler and found that the std::string works better than the old C string, and that the cin and cout commands work better than gets and scanf.
I really don't see much of a problem unless you are converting Pre-ANSI C code to the current standard or something. I think that the scope changed, but back in 1987 we were taught to keep variable names used in functions inside of functions, etc to keep the scope the same and don't try to access something out of scope. I guess that is why my programs converted so easily? They also didn't need a lot of resources or libraries and were simple programs written for the command line for DOS using Turbo C.
Should I use CLANG or LLVM instead? How about Visual C++ or Borland C++? Am I doing wrong trying to learn GCC and G++ or should I try learning under a different C++ compiler?