I'm looking for some convincing arguments against mixing C with C++ code except where there is a "good" reason, i.e. to use C library functions that aren't available in C++.
Frequently, these mixtures seem to turn up in students' programs involving i/o operations, probably most often because they didn't really know what they were doing & searched for code snippets containing any workable solution without regard to whether it's C or C++. Another reason might be that the students' introduction to programming was in C and they are being lazy about adopting C++ alternatives.
I can argue that code that seems to be an indiscriminate mixture of C and C++
- is irritating to read and
- indicates sloppiness/carelessness on the part of the programmer
but that sounds like it's just my personal prejudice.
I can argue that "you are taking a course in C++, so you have to do things the C++ way," but that sounds very arbitrary and more or less begs the question.
I have seen some remarks to the effect that "it's not a good idea to mix C and C++ io streams," but not much in terms of why.
I'm sure that the experienced programmers here can be much more eloquent than I on this topic. Please give me your thoughts.