Lately, I've seen a couple of C questions "with some C++". Here is one: Why does my function only update the struct when I pass it with an & symbol?
Quote from questions in case it disappears:
For those asking, we've been taught to code in C using some C++ elements (such as the pass by reference from C++ or cin/cout) to make it easier, therefore it may seem to you that the code is not C nor C++.
How should this be handled? My spontaneous thought is that if you use even the tiniest bit of C++, then you need to compile it with a C++ compiler. This means that you instantly get the restrictions that C++ has, but C doesn't.
I could start a rant about why this is stupid, like that it creates bad habits such as casting malloc
, but that's not the topic here.
I think that these questions should be tagged with C++ and not C. Am I right? After all, it is not valid C code.