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 1080487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:02:25+00:00 2026-05-16T22:02:25+00:00

I have the following declaration in my code: u32 volatile __attribute__((nocast)) *A, *B; Is

  • 0

I have the following declaration in my code:

u32 volatile __attribute__((nocast)) *A, *B;

Is this equivalent to:

u32 volatile __attribute__((nocast)) *A;
u32 volatile __attribute__((nocast)) *B;

or:

u32 volatile __attribute__((nocast)) *A;
u32 volatile                         *B;

or even:

u32 volatile __attribute__((nocast)) *A;
u32                                  *B;

A small update for this. It’s linux kernel code, so the only possible compiler is gcc. I know that I’m probably going to end up writing this on multiple lines, but I am curious.

For example, in the following linux kernel code, they use it similarly to how I wanted to. Is that code buggy?


One final update, if I use the following code:

int main() {
    int __attribute__((weak)) a, b;
}

I get the following warnings under gcc:

foo.c: In function ‘main’:
foo.c:5: error: weak declaration of ‘a’ must be public
foo.c:5: error: weak declaration of ‘b’ must be public

This says to me that it’s trying to apply the attribute to both variables. I’m going to run with the idea that it doesn’t vary over attribute types.

  • 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-05-16T22:02:26+00:00Added an answer on May 16, 2026 at 10:02 pm

    volatile qualifier is a common part of the entire declaration. The * is a part of an individual declarator. So

    u32 volatile *A, *B;
    

    is equivalent to

    u32 volatile *A;
    u32 volatile *B;
    

    This is what the language specification says.

    However, __attribute__ is not a part of the language, meaning that you have to consult your compiler documentation to figure out how it behaves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen a web page source code containing the following css declaration at
I have the following struct declaration and typedef in my code: struct blockHeaderStruct {
I have the following code, the struct declaration is before the main, so is
I have the following code, this code was recommended to me by stackoverflow user
I have the following code right after my controller class declaration before_filter :load_form, :except
I have the following code: try { FileStream FS = new FileStream(this.InFile, FileMode.Open, FileAccess.Read);
I have the following code snippet of a small Thread class I am trying
In my head.phtml , I have following declaration for getting a menu work. <script
i have the following property declaration Public Property IsAreaSelected() As Integer Get Return If(ViewState(IsAreaSelected)
I have the following template declaration: template <typename T> void IterTable(int& rIdx, std::vector<double>& rVarVector,

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.