Hi,
I have a general 32-bit value :
typedef union { signed __int32 l ; unsigned __int32 ul ; float f ; signed __int16 n[2] ; unsigned __int16 un[2] ; signed __int8 c[4] ; unsigned __int8 uc[4] ; } tVal32 ;
you get the idea.
Now when I need to initialize these objects (e.g. in const arrays of tVal32) , I can only do it in the signed __int32 format, 'coz that's how C works.
Actually my situation is a bit more complex than this as I use tVal32 as part of a structure :
typedef struct { tVal32 Val ; tVal32 Max ; tVal32 Min ; unsigned __int32 ulAttributes ; } tParam ;
I then want to define a constant array of tParam objects, where some of the Val, Max, Min fields are float, some __int32 etc
Does anyone know a slick way of doing this ?
The only way I have found is to define individual types for each flavour of tParam (i.e. tFloatParam, tS32Param etc) and then define them as a list of individual objects, and rely on the compiler / linker putting these in order in memory as if they were and array of tParam.
This seems questionable as it produces irritating warning about unredeemed variables and assumes the compiler / linker will always lay the objects out in memory as if they were an array simply because they appear like that in the source code.
I hope I made my question clear, and any help will be appreciated.
Gary.