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

The Archive Base Latest Questions

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

Using GCC and C99 mode, I have a function declared as: void func(float *X);

  • 0

Using GCC and C99 mode, I have a function declared as:

void func(float *X);

When I call the function, I use a volatile array Y:

volatile float Y[2];
int main()
{
    func(Y);
    return 0;
}

When compiling (with -Wall), I get the following warning:

warning: passing argument 1 of ‘func’ discards qualifiers from pointer target type
blah.c:4: note: expected ‘float *’ but argument is of type ‘volatile float *’

I can eliminate it with an explicit (float *) type cast, but this repeats in many places in the code.

Is there a way to eliminate this specific warning, with an option or a pragma (or something equivalent)?

  • 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-10T09:51:25+00:00Added an answer on June 10, 2026 at 9:51 am

    No, you can’t turn that warning off. It’s telling you you’re violating the type system. If you want to call func you either need to pass it pointers to non-volatile data or change the function signature to accept pointers to volatile data.

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

Sidebar

Related Questions

I'm using gcc 4.3.2. I have the following code (simplified): #include <cstdlib> template<int SIZE>
GCC 4.4.1, C99 I am using size_t , and size_t is an unsigned int
compiling with gcc C99 I have been using enums for a while now. However,
i am using gcc 4.4.3 on ubuntu 10.4 32bit machine. i use 'gdb' to
I have a c99 function that uses openmp, which works as expected. I also
What gcc options shall I use to enforce ANSI C (C99) warnings/errors? gcc (GCC)
linux gcc 4.4.1 C99 I am just wondering is there any advantage using the
I'm using an old m68k-elf-gcc that doesn't support C99 on a project, with Eclipse
Using gcc 4.6 with -O3, I have timed the following four codes using the
Using GCC 4.2. I have this metatemplate for conditional type: template <bool condition, typename

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.