macro's rewrite to follow the c++ convention -


I have so how can the following macro rewrite that they really ++ C followed conference? (In C ++, we prefer to use the typedef , const and inline function).
on macro

  #define UBYTE unsigned char #define ULONG unsigned long #define FALSE 0 #define COMPRESS_MAX_COM 0x70000000 #define COMPRESS_MAX_ORG (1024-COMPRESS_OVERRUN) #define MAX_RAW_GROUP (16 * MAX_RAW_ITEM) #define u (x) ((ULONG) x)   

How can I change the above macro in C ++ conference?

Use typedef or using (C ++ 11) instead of code> #define for the const use functions constexpr C + Can be defined in + 11.

  typedef unsigned four UBYTE; // UBYTE = Using unsigned char; // C ++ 11 typed without long typed; Const unsigned int FALSE = 0; // constexpr intigned int FALSE = 0; // C ++ 11 Constellation COMPRESS_MAX_COM = 0x70000000; Kont Ulong COMPRESS_MAX_ORG = (1024-COMPRESS_OVERRUN); // if COMPRESS_OVERRUN const const is ULONG MAX_RAW_GROUP = (16 * MAX_RAW_ITEM); // if MAX_RAW_ITEM as a pre-defined constants #define u (x) ((ULONG) x) // can it be this   

or < Pre> template & lt; Typename T & gt; Ulaan U (Kontt & T) {Return Static_cast & lt; ULong & gt; (X); }

then U (some type T) will return to its argument of a raw-ULong type T .

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -