what does this macro definition do?

Viewed 100

I have no idea what ALIGMENT_ATTRIBUTE(B) is suppose to do in typedef because it is a empty definition. Does it form a function?

#define ALIGNMENT_ATTRIBUTE(B)

typedef ALIGNMENT_ATTRIBUTE(8) UInt64   T_AUInt64;
1 Answers

It can be used in platforms where the alignment matters.

For example, it can be used in a platforms where uint64 must be located at an address which is divisible by 8.

In such scenario, you'd need to extend the definition of ALIGNMENT_ATTRIBUTE(B) using the platform's alignment-enforcement mechanism (which is typically compiler-specific), such as #pragma align(8) or alignas(8) or _declspec(align(8)).

In your specific example, it is defined as nothing, which implies that your platform does not have any alignment restrictions.

Related