Здравствуйте, x64, Вы писали:
x64>Зависит от того, что ты хотел получить в итоге. Например, если HANDLE заменить на PBYTE, то получится очень даже системная вещица.
Здравствуйте, Sni4ok, Вы писали:
S>Здравствуйте, рыбак, Вы писали:
Р>>Я не извращенец
S>я с вами не согласен, ибо использование голых хэндлов без обёрток — говорит об обратном.
Здравствуйте, рыбак, Вы писали:
Р>В самый ответственный момент написания кода меня отвлекли и получилось такое:
Р>
Р>HANDLE h = CreateMutex;
Р>
Р>Естественно, оно комплириуется без ворнингов и ошибок.
Странно, VS вроде ругался...
Но я с подобным встречался, когда писал под одно хиитрое устройство...
Я потом целый день ломал голову, почему не выполняется код в функции при вызове CreateMutex( в реале другая функция была, но не суть )
Здравствуйте, alexeiz, Вы писали:
A>Но VC++ такое компилит. А вот если указать опцию /Za (disable extensions), то уже не компилит с ошибкой:
Там всё гораздо жёстче.
#include <windows.h>
int main()
{
HANDLE h = CreateMutex;
}
не компилит с тучей ошибок (путь до PlatformSDK обрезал, чтоб не захламлять)
winnt.h(477) : error C2467: illegal declaration of anonymous 'struct'
winnt.h(495) : error C2467: illegal declaration of anonymous 'struct'
winnt.h(7723) : error C2467: illegal declaration of anonymous 'struct'
winnt.h(7732) : error C2467: illegal declaration of anonymous 'struct'
winnt.h(8248) : error C2467: illegal declaration of anonymous 'struct'
winnt.h(9066) : error C2133: '_EVENTSFORLOGFILE::pEventLogRecords' : unknown size
winnt.h(9072) : error C2133: '_PACKEDEVENTINFO::ulOffsets' : unknown size
winbase.h(232) : error C2467: illegal declaration of anonymous 'struct'
winbase.h(558) : error C2467: illegal declaration of anonymous 'struct'
wingdi.h(1893) : error C2467: illegal declaration of anonymous 'struct'
wingdi.h(1899) : error C2467: illegal declaration of anonymous 'struct'
wingdi.h(1947) : error C2467: illegal declaration of anonymous 'struct'
wingdi.h(1953) : error C2467: illegal declaration of anonymous 'struct'
winreg.h(113) : error C2146: syntax error : missing ';' before identifier 'QUERYHANDLER'
winreg.h(114) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(116) : error C2143: syntax error : missing ';' before '*'
winreg.h(116) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(116) : error C2365: 'QUERYHANDLER' : redefinition; previous definition was 'function'
winreg.h(113) : see declaration of 'QUERYHANDLER'
winreg.h(116) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(119) : error C2146: syntax error : missing ';' before identifier 'pi_R0_1val'
winreg.h(119) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(119) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(120) : error C2146: syntax error : missing ';' before identifier 'pi_R0_allvals'
winreg.h(120) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(120) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(121) : error C2146: syntax error : missing ';' before identifier 'pi_R3_1val'
winreg.h(121) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(121) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(122) : error C2146: syntax error : missing ';' before identifier 'pi_R3_allvals'
winreg.h(122) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
winreg.h(122) : error C4430: missing type specifier — int assumed. Note: C++ does not support default-int
mmsystem.h(1837) : error C2467: illegal declaration of anonymous 'struct'
mmsystem.h(1841) : error C2467: illegal declaration of anonymous 'struct'
mmsystem.h(1862) : error C2467: illegal declaration of anonymous 'struct'
mmsystem.h(1866) : error C2467: illegal declaration of anonymous 'struct'
rpcndr.h(1021) : error C2133: '_MIDL_FORMAT_STRING::Format' : unknown size
wtypes.h(1001) : error C2467: illegal declaration of anonymous 'struct'
wtypes.h(1028) : error C2467: illegal declaration of anonymous 'struct'
wtypes.h(1041) : error C2467: illegal declaration of anonymous 'struct'
oaidl.h(484) : error C2467: illegal declaration of anonymous 'struct'
oaidl.h(486) : error C2467: illegal declaration of anonymous 'struct'
msxml.h(595) : warning C4224: nonstandard extension used : formal parameter 'DOMDocument' was previously defined as a type
msxml.h(1213) : warning C4224: nonstandard extension used : formal parameter 'DOMDocument' was previously defined as a type
propidl.h(371) : error C2467: illegal declaration of anonymous 'struct'
t.cpp(7) : error C2440: 'initializing' : cannot convert from 'HANDLE (*)(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR)' to 'HANDLE'
There is no context in which this conversion is possible
Здравствуйте, Кодт, Вы писали:
К>Здравствуйте, alexeiz, Вы писали:
A>>Но VC++ такое компилит. А вот если указать опцию /Za (disable extensions), то уже не компилит с ошибкой:
К>Там всё гораздо жёстче. К>
К>#include <windows.h>
...
Ну так это понятно. Windows SDK никогда не компилировался в /Za режиме. В моём примере я специально ввёл локальное определение HANDLE без <windows.h>.
Кстати, так как /Za практически никто не использует, там могут быть баги, которых иначе в VC++ нет.
Да, забавно. COleDateTime::valid — это значение 0 из enum'а, COleDateTime имеет operator DATE(), а DATE — это просто double. Происходит сравнение двух double.