Hacker News new | ask | show | jobs
by khoobid_shoma 1459 days ago
> "Let us consider the following C++ code:"

But, C code is shown. I do not get why people tend to avoid using C name.

2 comments

If it's compiled with a C++ compiler as C++ then it's C++ code. In this example the meaning is the same but some "C code" will produce different results depending on whether you compile it as C or C++.
It's compiled with a C++ compiler ('_Z2f2i' in the disassembly) and the function name is 'f.cpp', so I suppose it's in the 'C is a subset of C++' part of C.
Still that's C code. Code is an input to the compiler. So, I would not call the code differently just because later a C++ comiler is used. In C++ code, we expect C++ specific features be used.