Hey guys, I've posted a little bit on these forums and gained some valuable knowledge of C++ thanks to some very helpful people here. I'm still a beginner really, but my understanding of certain C++ concepts has improved a lot thanks to them.
This isn't strictly to do with C++, but what I would like to ask is whether or not it would be difficult to transition from C++ to C, with an understanding of concepts such as variables, i/o, conditionals, loops and functions?
I ask this because I will be starting my studies on a Computer Science course soon and have found out that the language we will be using is C.
Semantically and syntactically, is C similar to C++? C++ is my only language so that could be an issue.
It's.. different, they may opt for minimalistic, single purpose apps. You're probably aware it's not object orientated and that you have to declare "all variables" up the top of a code block preceding any statements. There's a lot of other subtle differences.
Microsoft compilers are two standards behind in C - they support C90 while there has been C99 and C11. In C99 and beyond you do not have the restriction of declaring all variables at the beginning of a code block.
Fun fact: the const keyword was brought into C from C++
Coming from someone who codes in a mix of C and C++ now adays, I can give a heads up.
The transition was mostly painless. Tools like valgrind and gdb become easier to use, errors are more obvious (no 150 line errors), etc.
However, I still use certain C++ libraries, specifically ASIO and cppformat. They are super powerful in both optimization and feature, while being incredibly easy to use. Doing something similar in C is damn near impossible without sacrificing usability.
I'd find the most enjoyable thing about using C is the simplified symbol mangling. Most compilers are as simple as prepending a "_" to the function name or variable. Note that there is no standard however. So things like fastcall (which is a bad example since gcc *does* actually support fastcall) can break interoperability between GCC and VC++.
Even given that situation, compared to C++ where ABI breaks between almost every single compiler I know of (aside from maybe gcc and clang) and even between different compiler versions, the simplification is bliss when it comes to linking and dynamically loading libraries (which you can't even do in C++ since there isn't a way to specify what symbol you want).
Even given that situation, compared to C++ where ABI breaks between almost every single compiler I know of (aside from maybe gcc and clang) and even between different compiler versions, the simplification is bliss when it comes to linking and dynamically loading libraries (which you can't even do in C++ since there isn't a way to specify what symbol you want).
This is the single greatest flaw with C++, and it seems that no one is addressing it.
Not so much, I don't even know the right place to put it. As long as you specify it's for C and not C++, you might get help instead of people asking you why you're using C.