Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 04-25-2013, 04:14 PM   #1
LQ Newbie
Registered: Apr 2013
Posts: 4

Rep: Reputation: Disabled
ATOMIC_INIT macro defined as a compound literal

While hacking the Linux kernel v3.2, I noticed some architectures defined the ATOMIC_INIT macro slightly different than most others.

#define ATOMIC_INIT(i)  { (i) }
#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?

Last edited by vilhelmgray; 04-25-2013 at 04:16 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to test whether a macro is defined rainman1985_2010 Programming 2 03-20-2011 07:37 AM
C++: Macro not defined in quotes!? CoderMan Programming 2 12-13-2009 12:39 AM
Way to convert Macro Defined functions from linux Kernel in Visual C++ Kunsheng Programming 5 06-29-2009 10:25 AM
too literal! treebug Linux - General 2 03-16-2006 01:30 PM
#defining a macro inside a macro? saravkrish Programming 1 05-24-2005 10:48 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration