How to determine if a project is a c or C ++ project?

wprintf(L"Selecting Audio Input Device: %s\n", 
                            varName.bstrVal);
if(0 == wcscmp(varName.bstrVal, L"IP Camera [JPEG/MJPEG]"))
{
    ...
}

hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
                        IID_IBaseFilter, (void **)&pGrabberF);

The above file is from .cpp, but as you can see, its contents are pretty c-style.

Do you call this a c or C ++ project?

+3
source share
3 answers

It just depends on how you compile it.

Some code will compile like both; it is considered C ++ code if it is compiled by the C ++ compiler.

C is not an exact subset of C ++ , by the way.

Often you can get a quick look just by the file extension, although you can put C code in the .cc extension or the .cpp extension, and you can also put C ++ code in the .c extension, but this will be quite rare.

+4
source

C, , ++. . bstrVal BSTR, == wchar_t *.

+1

, . , C, C. ++, ++. , .

, , , ++, ++.

Update0

. , , C ++.

0

Source: https://habr.com/ru/post/1764506/


All Articles