View mode: basic / threaded / horizontal-split · Log in · Help
December 23, 2007
C++ const to D2 const
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 ?

...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 ...
Thanks in advance.
Bjoern
December 23, 2007
Re: C++ const to D2 const
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
December 23, 2007
Re: C++ const to D2 const
"Bill Baxter" <dnewsgroup@billbaxter.com> wrote in message 
news:fkm8vn$2p75$1@digitalmars.com...

> 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.

...except that if this isn't a static struct declaration, you have to write:

RECT r = RECT(0, 0, 0, 0);

:P
Top | Discussion index | About this forum | D home