While hacking the
Linux kernel v3.2, I noticed some architectures defined the
ATOMIC_INIT macro slightly different than most others.
arch/x86/include/asm/atomic.h:
Code:
#define ATOMIC_INIT(i) { (i) }
arch/alpha/include/asm/atomic.h:
Code:
#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
In later versions of the Linux kernel, the compound literal definition is replaced with the definition used in the
x86 architecture code. This was probably done to allow the initialization of
static atomic_t variables, which aren't possible if using compound literals.
Does anyone know why a compound literal was even used in the first place?