[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 4/5] cmocka: Use cast_ptr_to_largest_integral_type in suitable places

On Tuesday 17 February 2015 14:21:44 Krzysztof Opasiak wrote:
> Please tell me, why do you use such ugly tricks with largest integer
> type and casting ptr instead of defining a union?
> You could simply do:
> typedef union {
> 	void  *ptr;
> 	LargestIntegerType integer;
> 	float f;
> 	double d;
> } ArgumentContent;
> typedef struct {
> 	enum ArgumentType type;
> 	ArgumentContent content;
> } Argument;

Yes, we should probably look into this and this about how to deal with it. The 
question is if this works correctly with big endian too.

Feel free to add it to:


or propose patches. We should choose a better name for what you suggest here 
and need tests to make sure it works correctly on the platform we support.

Best regards,

	 -- andreas

Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx