C++ const to D2 const

Bill Baxter dnewsgroup at billbaxter.com
Sun Dec 23 10:21:39 PST 2007


BLS wrote:
> Sorry about the ignorance, but I am not a C++ programmer.
> C++ / WIN API prog.
> HINSTANCE GetResourceHandle() const { return (m_hResource ? 
> m_hResource:m_hInstance); }

> D2
> invariant HINSTANCE GetResourceHandle()
> 
> Just guessing, can you confirm ?
> 

No idea there.

> ...and by the way a very confusing C++ language construct.
> RECT r = {0};
> 
> Does it mean : Set all members to 0 ? How to port this stuff into D ...

Yes it does.  In D you have to specify all the members.  RECT should 
have 4, so
    RECT r = {0,0,0,0};
should do it.


--bb


More information about the Digitalmars-d-learn mailing list