macros

B

Bill Cunningham

I was browsing the linux kernel source and came across something I've never
seen. Here's an example

#define (thismacro)
#define (1<<(thismacro))

What is this doing? Why the parenthesis around the macro defines, on each
line?

Bill
 
J

Joona I Palaste

Bill Cunningham said:
I was browsing the linux kernel source and came across something I've never
seen. Here's an example
#define (thismacro)
#define (1<<(thismacro))
What is this doing? Why the parenthesis around the macro defines, on each
line?

I don't think #define (1<<(thismacro)) is valid C syntax at all.
 
N

Nils Petter Vaskinn

I was browsing the linux kernel source and came across something I've never
seen. Here's an example

#define (thismacro)
#define (1<<(thismacro))

What is this doing? Why the parenthesis around the macro defines, on each
line?

Doesn't look like C, are you sure you didn't miss anything in your
example? It might be a gcc specific thing though, but a quick glance at
the gcc info pages didn't shed any light on it.

Looking at the actual usage instead of your example might help shed some
light on it.
Kernel version?
File?
Line?

regards
 
C

Christopher Benson-Manica

I don't think #define (1<<(thismacro)) is valid C syntax at all.

Neither is #define (thismacro), for that matter, right? gcc says that macro
names must be identifiers...
 
B

Bill Cunningham

Nils Petter Vaskinn said:
Doesn't look like C, are you sure you didn't miss anything in your
example? It might be a gcc specific thing though, but a quick glance at
the gcc info pages didn't shed any light on it.

Looking at the actual usage instead of your example might help shed some
light on it.
Kernel version?
File?
Line?

regards
It figures. Now I can't find it but I believe it had something to do with
sys calls or calling sys calls. I'll keep looking. I'm almost sure I've seen
code like

#define (something)

before in a header or source file. But if it's a syntax error, maybe I'm
mistaken.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top