A
Alf P. Steinbach
Grr.
What's wrong with this code?
struct WndClassEx: WNDCLASSEX
{
WndClassEx(
cppx::WideString const& name,
Params const& params
)
: WNDCLASSEX()
{
cbSize = sizeof( WNDCLASSEX );
style = params.style();
lpfnWndProc = &DefWindowProc;
hInstance = params.module();
hCursor = ::LoadCursor( 0, IDC_ARROW );
hbrBackground = reinterpret_cast<HBRUSH>( COLOR_BTNFACE + 1 );
lpszClassName = name.cStr();
}
WndClassEx const* ptr() const
{
return this;
}
};
Answer: nothing in particular, at least when one knows that it's just a little
local helper class where 'name' arg has lifetime guaranteed to be enough.
But MinGW g++ doesn't zero-initialize the WNDCLASSEX as it should (this is a
plain struct with no constructor, provided by the Windows API).
Argh!
I knew old MSVC doesn't always zero-initialize /arrays/ when told to.
But I didn't know that g++ doesn't zero-initialize /structs/ when told to.
And by the way, the gdb debugger is driving me crazy. Ignoring breakpoints and
telling me the source code for some stack frame is at arbitrary location in
arbitrary file. And yes, optimizations turned off, which is another annoyance,
since g++ needs optimizations on to e.g. warn about uninitialized things.
Not to mention the Code::Blocks IDE's debugger output display, which doesn't
display anything of interest, just a bunch of info lines about internal details
of the debugger, and actively *swallows* trace output, which is what I'd need.
Happily it's possible to view a (nearly, almost, but of course not 100%)
complete log of the IDE's interaction with the brain-damaged debugger beast, and
there one can present stderr output. But. Oh well.
I need coffee.
- Alf
What's wrong with this code?
struct WndClassEx: WNDCLASSEX
{
WndClassEx(
cppx::WideString const& name,
Params const& params
)
: WNDCLASSEX()
{
cbSize = sizeof( WNDCLASSEX );
style = params.style();
lpfnWndProc = &DefWindowProc;
hInstance = params.module();
hCursor = ::LoadCursor( 0, IDC_ARROW );
hbrBackground = reinterpret_cast<HBRUSH>( COLOR_BTNFACE + 1 );
lpszClassName = name.cStr();
}
WndClassEx const* ptr() const
{
return this;
}
};
Answer: nothing in particular, at least when one knows that it's just a little
local helper class where 'name' arg has lifetime guaranteed to be enough.
But MinGW g++ doesn't zero-initialize the WNDCLASSEX as it should (this is a
plain struct with no constructor, provided by the Windows API).
Argh!
I knew old MSVC doesn't always zero-initialize /arrays/ when told to.
But I didn't know that g++ doesn't zero-initialize /structs/ when told to.
And by the way, the gdb debugger is driving me crazy. Ignoring breakpoints and
telling me the source code for some stack frame is at arbitrary location in
arbitrary file. And yes, optimizations turned off, which is another annoyance,
since g++ needs optimizations on to e.g. warn about uninitialized things.
Not to mention the Code::Blocks IDE's debugger output display, which doesn't
display anything of interest, just a bunch of info lines about internal details
of the debugger, and actively *swallows* trace output, which is what I'd need.
Happily it's possible to view a (nearly, almost, but of course not 100%)
complete log of the IDE's interaction with the brain-damaged debugger beast, and
there one can present stderr output. But. Oh well.
I need coffee.
- Alf