Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this macro definition do?

Tags:

c++

c

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;
like image 477
jojo_Aero_smith_the_dummy Avatar asked Dec 29 '21 08:12

jojo_Aero_smith_the_dummy


People also ask

What is macro define with example?

Macro is defined as something that covers a large amount, or is large in size. An example of macro is the study of the key driving aspects of an economy; macro economics. An example of macro is a very close up photograph of an ant; a macro photograph. adjective.

What is a macro and how does it work?

A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes. After you create a macro, you can edit it to make minor changes to the way it works.

Where do we define macro definition?

A macro definition is a named sequence of statements you can call with a macro instruction. When it is called, the assembler processes and normally generates assembler language statements from the definition into the source module. The statements generated can be: Copied directly from the definition.


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.

like image 177
bbbbbbbbb Avatar answered Oct 26 '22 23:10

bbbbbbbbb