Thread overview | |||||
---|---|---|---|---|---|
|
September 22, 2007 C++ ref parameter passing to D parameter ... | ||||
---|---|---|---|---|
| ||||
Hi, still at a marathon porting session. I am pretty sure that my D port is correct, but due to the fact that I have to translate similar stuff hundrets of time, I would like to asure myself.. C++ bool GetLogFont(LOGFONT& LogFont) { ASSERT(m_hFont != NULL); return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT)); } D bool GetLogFont(ref LOGFONT LogFont) { assert(m_hFont !is NULL); return (GetObject(m_hFont, LOGFONT.sizeof, &LogFont) == LOGFONT.sizeof); } Many thanks in advance,Bjoern |
September 22, 2007 Re: C++ ref parameter passing to D parameter ... | ||||
---|---|---|---|---|
| ||||
Posted in reply to BLS | BLS wrote: > Hi, still at a marathon porting session. > I am pretty sure that my D port is correct, but due to the fact that I have to translate similar stuff hundrets of time, I would like to asure myself.. > > C++ > bool GetLogFont(LOGFONT& LogFont) > { > ASSERT(m_hFont != NULL); > return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT)); > } > > D > bool GetLogFont(ref LOGFONT LogFont) > { > assert(m_hFont !is NULL); > return (GetObject(m_hFont, LOGFONT.sizeof, &LogFont) == LOGFONT.sizeof); > } > > Many thanks in advance,Bjoern Looks good to me. You might want to make that .GetObject to be a little truer to the original. (See "module scope operator" here http://www.digitalmars.com/d/module.html) --bb |
September 22, 2007 Re: C++ ref parameter passing to D parameter ... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter schrieb:
> BLS wrote:
>> Hi, still at a marathon porting session.
>> I am pretty sure that my D port is correct, but due to the fact that I have to translate similar stuff hundrets of time, I would like to asure myself..
>>
>> C++
>> bool GetLogFont(LOGFONT& LogFont)
>> {
>> ASSERT(m_hFont != NULL);
>> return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT));
>> }
>>
>> D
>> bool GetLogFont(ref LOGFONT LogFont)
>> {
>> assert(m_hFont !is NULL);
>> return (GetObject(m_hFont, LOGFONT.sizeof, &LogFont) == LOGFONT.sizeof);
>> }
>>
>> Many thanks in advance,Bjoern
>
> Looks good to me.
> You might want to make that .GetObject to be a little truer to the original. (See "module scope operator" here http://www.digitalmars.com/d/module.html)
>
> --bb
Thanks,
GetObject is a method within the same class.
class X
{
bool GetObject()
bool GetFontLog()
}
I guess I miss something, as allways :)
Bjoern (need a time out)
|
Copyright © 1999-2021 by the D Language Foundation