The CAPI Manifesto

Walter Bright newshound2 at digitalmars.com
Mon Oct 17 14:33:52 PDT 2011


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


More information about the Digitalmars-d mailing list