Re: Reentrant API/IDL_KW_OFFSETOF() issue [message #38537 is a reply to message #38536] |
Tue, 16 March 2004 16:07  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
"Rick Towler" wrote in message...
> I have run into a problem with the IDL_KW_OFFSETOF() macro and the new
> keyword processing API. Starting with a functioning .cpp dlm, I set about
> to add a few keywords. Along the way I decided to switch the keyword
> processing to use the new API. A fine way to spend an afternoon...
>
> The problem is that the compiler chokes on the return value from
> IDL_KW_OFFSETOF() macro. It expects "char *" and gets "void *". I can
> recast everything but the EDG (and Ronn's book) make no mention of this
and
> my C/C++ skills are such that I don't really trust myself and assume that
I
> am in the wrong.
>
> I see IDL_KW_V_OFFSETOF() returns "char *" but again, no mention in the
EDG
> or Ronn's book.
I'm no Barnaby Jones, but looking at the following from the export.h file
(5.5-6.0):
#define IDL_KW_OFFSETOF2(s, m) ((void *)(&(((s *)0)->m)))
#define IDL_KW_V_OFFSETOF2(s, m) ((char *)(&(((s *)0)->m)))
#define IDL_KW_S_OFFSETOF2(s, m) ((int *)(&(((s *)0)->m)))
#define IDL_KW_OFFSETOF(m) IDL_KW_OFFSETOF2(KW_RESULT, m)
#define IDL_KW_V_OFFSETOF(m) IDL_KW_V_OFFSETOF2(KW_RESULT, m)
#define IDL_KW_S_OFFSETOF(m) IDL_KW_S_OFFSETOF2(KW_RESULT, m)
The names lead me to believe that IDL_KW_V_OFFSETOF2() would return void and
(by default, as it would be the most common use) IDL_KW_OFFSETOF2() would
return char. But if this were the case I am sure someone would have run
into this?
-Rick
|
|
|