Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8457401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:47:51+00:00 2026-06-10T12:47:51+00:00

i found this macro in one kernel code.. http://lxr.free-electrons.com/source/arch/alpha/include/asm/io.h?v=3.0;a=arm#L140 #define IO_CONCAT(a,b) _IO_CONCAT(a,b) #define _IO_CONCAT(a,b)

  • 0

i found this macro in one kernel code..
http://lxr.free-electrons.com/source/arch/alpha/include/asm/io.h?v=3.0;a=arm#L140

#define IO_CONCAT(a,b)  _IO_CONCAT(a,b)
#define _IO_CONCAT(a,b) a ## _ ## b

i am unable to understand the meaning of this.Does anybody know this?

Edit :

Then here what it will return

  return IO_CONCAT(__IO_PREFIX,readl)(addr);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:47:53+00:00Added an answer on June 10, 2026 at 12:47 pm

    Double hash is used to concatenate two tokens together:

    #define CONCAT(a,b) a ## b
    
    CONCAT(x, y) # Gives 'xy'
    

    However, such naive implementation doesn’t work in case when one of the arguments being passed is a macro itself:

    #define Z y
    CONCAT(x, Z) # Gives 'xZ', not 'xy' as one might expect
    

    That is why macro indirection is used in your question:

    #define CONCAT(a,b)  __CONCAT(a,b)
    #define __CONCAT(a,b) a ## b
    
    #define Z y
    CONCAT(x, Z) # Gives 'xy' 
    

    UPD.

    Now consider the concrete example you’re asking about:

    return IO_CONCAT(__IO_PREFIX,readl)(addr);
    

    Here __IO_PREFIX is obviously a macro (uppercase identifiers in Linux kernel are often macros). It is defined in several places, one of them is:

    #define __IO_PREFIX             generic
    

    Now let’s see which steps are taken to expand the original statement:

    1. Expand __IO_PREFIX:
      return IO_CONCAT(generic,readl)(addr);
      
    2. Expand IO_CONCAT(...):
      return _IO_CONCAT(generic,readl)(addr);
      
    3. Expand _IO_CONCAT(...):
      return generic_readl(addr);
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found this macro while digging in the source code of tweejump game.
In one of the C source code files I found the following line (macro):
I'm compiling a nexus one android kernel from source as found on HTCs developer
I needed the HIDWORD macro for a program I'm making and found this one
found this little code snippet that seems to do what i want, but im
i found this code from here #if 1 #define rsAssert(v) do {if(!(v)) LOGE(rsAssert failed:
I found this question, but the one answer was basically, you wouldn't want to
There’s a really cool diff class hosted by Google here: http://code.google.com/p/google-diff-match-patch/ I’ve used it
As described in http://support.microsoft.com/kb/278591 PowerPoint will usually combine all changes that a macro or
I'm having a performance issue in my Excel macro. One particular piece of code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.