|
From: Devin S. <dev...@gm...> - 2010-06-15 18:10:38
|
Hi,
Is it possible to make a call to CoCreateInstance and compile with -O2
without getting the "dereferencing type-punned pointer will break
strict-aliasing rules" warning? Every call to this function generates
this warning message and this can quickly flood/spam the compiler
output and mask legitimate warnings.
For example, here's how I would create an ADO Connection object.
HRESULT hr;
ADOConnection *conn = NULL;
hr = CoCreateInstance(&CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
&IID_IADOConnection, (LPVOID *)&conn);
This code compiles in Visual C++ 6.0 and lcc-win32 without any warnings.
Thanks in advance
|