Using nullptr in API function calls?

Using C ++ with Visual Studio 2010. I'm in the process of converting mine NULLto nullptr. With my code this is normal. However, if I call WINAPI, for example:

__checkReturn WINOLEAPI OleInitialize(IN LPVOID pvReserved);

I would usually call this the following:

::OleInitialize(NULL);

Is it safe to use nullptrwhere I would use NULLin a call like this?

That is, can I do this:

::OleInitialize(nullptr);

Same with MFC api:

CFileDialog fileDlg(TRUE, ".txt", NULL, 0, strFilter);

Is it possible to replace

CFileDialog fileDlg(TRUE, ".txt", nullptr, 0, strFilter);

I suppose I can, but I just want to make sure there are no errors.

UPDATE

So, I went through and replaced all my NULL with nullptr and it seems to work the most ubiquitous, but I get the following error in the following line:

propertyItem = new CMFCPropertyGridProperty(_T("SomeName"),
"SomeValue", "SomeDescription", nullptr, nullptr, nullptr, nullptr);

8 > c:\something\something.cpp(118): C2664: 'CMFCPropertyGridProperty:: CMFCPropertyGridProperty (const CString &, const COleVariant &, LPCTSTR, DWORD_PTR, LPCTSTR, LPCTSTR, LPCTSTR) ': 4 'nullptr' 'DWORD_PTR' 8 > A native nullptr bool , reinterpret_cast,

(. CMFCPropertyGridProperty - Microsoft MFC). ?

+5
1

, nullptr , NULL.

NULL , . nullptr - "-", : .

.

+12

All Articles