Use one define inside another?

  c++, opencl

I’m writing an OpenCL kernel and need to have a certain define.
Through the compiler arguments for the kernel I set a define called VECTOR_SIZE which is just a number, e.g. 2, 8 or 16.
Then in the kernel I need a define that would extend to float2, float8 or float16.
I tried this:

#define FLOAT_VECTOR float##VECTOR_SIZE

This doesn’t work.
I also tried the following:

#define FLOAT_VECTOR(a) float##a

Also doesn’t work.

Source: Windows Questions C++

LEAVE A COMMENT