translate a macro to D

2011-07-06 Thread teo
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.

Re: translate a macro to D

2011-07-06 Thread Trass3r
Am 06.07.2011, 16:15 Uhr, schrieb teo : 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

Re: translate a macro to D

2011-07-07 Thread teo
On Wed, 06 Jul 2011 16:21:31 +0200, Trass3r wrote: > Am 06.07.2011, 16:15 Uhr, schrieb teo : > >> 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 a

Re: translate a macro to D

2011-07-07 Thread Trass3r
The TYPESIZE macro is used within another macro which defines constants. #define M(a,b,size) \ ((a) << SHIFT_A) | \ ((b) << SHIFT_B) | \ ((size) << SHIFT_SIZE)) #define MM(a,b,type)M((a),(b),(TYPESIZE(type))) Example: #define C1MM(1, 2, struct A) #define

Re: translate a macro to D

2011-07-07 Thread Steven Schveighoffer
On Thu, 07 Jul 2011 11:38:05 -0400, teo wrote: On Wed, 06 Jul 2011 16:21:31 +0200, Trass3r wrote: Am 06.07.2011, 16:15 Uhr, schrieb teo : 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 wo

Re: translate a macro to D

2011-07-07 Thread teo
On Thu, 07 Jul 2011 17:54:40 +0200, Trass3r wrote: >> The TYPESIZE macro is used within another macro which defines >> constants. #define M(a,b,size) \ >> ((a) << SHIFT_A) | \ >> ((b) << SHIFT_B) | \ >> ((size) << SHIFT_SIZE)) >> #define MM(a,b,type) M((a),(b),(TYPESIZE(ty

Re: translate a macro to D

2011-07-07 Thread teo
On Thu, 07 Jul 2011 11:57:51 -0400, Steven Schveighoffer wrote: > Well, I can't really say I understand the point of using this macro at > all. sizeof is a builtin, and part of the C spec. Why not just use > sizeof? > Well, have a look please at ioctl.h (linux). You will find the following ma

Re: translate a macro to D

2011-07-08 Thread Steven Schveighoffer
On Thu, 07 Jul 2011 16:23:33 -0400, teo wrote: On Thu, 07 Jul 2011 11:57:51 -0400, Steven Schveighoffer wrote: Well, I can't really say I understand the point of using this macro at all. sizeof is a builtin, and part of the C spec. Why not just use sizeof? Well, have a look please at ioc

Re: translate a macro to D

2011-07-11 Thread teo
On Fri, 08 Jul 2011 09:54:40 -0400, Steven Schveighoffer wrote: > On Thu, 07 Jul 2011 16:23:33 -0400, teo wrote: > >> On Thu, 07 Jul 2011 11:57:51 -0400, Steven Schveighoffer wrote: >> >>> Well, I can't really say I understand the point of using this macro at >>> all. sizeof is a builtin, and p

Re: translate a macro to D

2011-07-11 Thread Steven Schveighoffer
On Mon, 11 Jul 2011 09:21:53 -0400, teo wrote: On Fri, 08 Jul 2011 09:54:40 -0400, Steven Schveighoffer wrote: On Thu, 07 Jul 2011 16:23:33 -0400, teo wrote: On Thu, 07 Jul 2011 11:57:51 -0400, Steven Schveighoffer wrote: Well, I can't really say I understand the point of using this macr

Re: translate a macro to D

2011-07-12 Thread teo
> > I think you may be confusing function templates with plain templates? > Yes, I was a bit confused by the syntax, but I found that type of templates on page 281 in TDPL. That is an eponymous template. Thanks.