translate a macro to D
Trass3r
un at known.com
Wed Jul 6 07:21:31 PDT 2011
Am 06.07.2011, 16:15 Uhr, schrieb teo <teo.ubuntu at yahoo.com>:
> What is the best way to translate following to D?
>
> #define MAKELONG(a, b) \
> ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) << 16))
>
> The point is I would like to be able to use that at compile-time. The
> macro is supposed to define some constants.
Just turn it into a function.
If you assign it to an enum or use it as an initializer for global
immutables it should be evaluated at compile-time.
More information about the Digitalmars-d-learn
mailing list