Is C code still considered C++?

前端 未结 8 1265
小鲜肉
小鲜肉 2021-01-11 22:52

The comment to this answer got me wondering. I\'ve always thought that C was a proper subset of C++, that is, any valid C code is valid C++ code by extension. Am I wrong a

8条回答
  •  旧巷少年郎
    2021-01-11 23:23

    A couple of other things that are valid C but not C++:

    int func();
    func(0,0); //Error in C++, but not in C
    

    Also don't underestimate the impact of C++ having more keywords:

    int new;  //Obviously an error in C++
    

提交回复
热议问题