I assume you are using
C
programming language (since
typedef
before
struct
isn't necessary in
C++
).
In
C
programming language, the cast could be written
void * data;
DATATYPE * d0 = (DATATYPE *) data;
Hence your macro would become
#define CAST(data, DATATYPE) (DATATYPE*)(data)
Usage:
DATATYPE * d1 = CAST(data, DATATYPE);
However, I question the usefulness of such a macro.