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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:38:38+00:00 2026-05-12T15:38:38+00:00

Using V1.8 z/OS XL C compiler, with warnings jacked-up using INFO(ALL), I get the

  • 0

Using V1.8 z/OS XL C compiler, with warnings jacked-up using INFO(ALL), I get the following warning on line 4 of the code below:

WARNING CCN3196 Initialization between types "const int** const" and "int**" 
                is not allowed.


1  int foo = 0;
2  int *ptr = &foo;

3  const int * const fixed_readonly_ptr = ptr;

4  const int ** const fixed_ptr_to_readonly_ptr = &ptr;

I can’t wrap my head around why I’m getting this warning. If I can assign an int pointer to a const pointer to const int (line 3), then why can’t I assign the address of an int pointer to a const pointer to pointer to const int? What am I missing?

Note the code above is a slimmed down example just showing the issue I’m encountering in a small amount of code. The real context is that I have a const pointer to pointer to struct (struct s** const) and am passing it as an argument to a function who’s parameter is defined as a const pointer to pointer to const struct (const struct s** const). This is because the function will not modify the data in the struct (hence the first const) and it does not modify the pointer parameter which always holds the address passed in (hence the second const). The value of the pointer pointed to may be changed by the way (which is why there is NOT a third const in between the **).

  • 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-12T15:38:38+00:00Added an answer on May 12, 2026 at 3:38 pm

    The C rule is that you can convert a pointer to something to a pointer to const something, but that something has to be exactly the same type including const and volatile qualifications further down the chain.

    The rationale for this rule is that if the second of these two lines were allowed:

    int *ptr;
    
    const int ** const fixed_ptr_to_readonly_ptr = &ptr;
    

    then this can be used to break type safety without a cast.

    const int i = 4;
    
    // OK, both sides have type const int *
    *fixed_ptr_to_readonly_ptr = &i;
    
    // the value of fixed_ptr_to_readonly_ptr is still &ptr
    // the value of ptr is now &i;
    
    *ptr = 5;
    
    // oops, attempt to change the value of i which is const
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody tell me how to remove all CA2202 warnings from the following code?
When using the ObsoleteAtribute in .Net it gives you compiler warnings telling you that
I am using the compiler Tree api to parse my code into a AST,
I'm newly using CODE::BLOCKS+mingw compiler If I don't type return 0 at the end
I'm currently getting compiler warnings that resemble the warning I gave in the question
Anybody knows how to write the piece of code below using generics AND avoiding
Custom Compiler Warnings and C#: Create custom warning in Visual Studio if certain method
I have an issue with some compiler warnings I am getting when using T4
I have an issue with some compiler warnings I am getting when using T4
I'm currently using a compiler that constantly returns warnings, I don't want to see

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.