The CAPI Manifesto

Peter Alexander peter.alexander.au at gmail.com
Mon Oct 17 16:04:37 PDT 2011


On 17/10/11 10:33 PM, Walter Bright wrote:
> On 10/17/2011 1:24 PM, Daniel Gibson wrote:
>> What about function-like macros, e.g. the Linux/POSIX cmsg stuff
>> (CMSG_FIRSTHDR(), CMSG_NXTHDR(), CMSG_LEN() etc) needed to use
>> functions like
>> recvmsg() and sendmsg()?
>>
>> Will there be a direct D translation of the functionality or will they be
>> omitted completely?
>
> Consider:
>
> #define FOO(x) bar((x) + 1)
>
> Do this:
>
> int FOO()(int x) { return bar(x) + 1; }
>
> Note that it's a function template with no template parameters. This
> will enable it to be "header only" and not require linking to some
> library to resolve FOO().

int FOO()(int x) { return bar(x + 1); }

would probably work better :-)

+1 for CAPI btw.


More information about the Digitalmars-d mailing list