Is it bad practice to use a C header instead of its C++ equivalent in C++ (e.g. stdio.h instead of cstdio)?

前端 未结 4 1206
北海茫月
北海茫月 2021-01-14 04:22

It seems that a lot of people include example.h instead of cexample in their C++ code. I know that everything in the C++ versions is declared in namespace std, but I\'m not

4条回答
  •  没有蜡笔的小新
    2021-01-14 04:54

    For example stdio.h is not the same as cstdio. The latter includes the first, but then undefines some macros and replaces them with real functions. Personally I would always go with the C++ headers!

提交回复
热议问题