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

  • Home
  • SEARCH
  • 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 8594681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:15:16+00:00 2026-06-12T00:15:16+00:00

GCC gives me folowing warning: note: expected ‘const void **’ but argument is of

  • 0

GCC gives me folowing warning:

note: expected 'const void **' but argument is of type 'const struct auth **

Is there any case, where it could cause problems?

Bigger snippet is

struct auth *current;
gl_list_iterator_next(&it, &current, NULL);

Function just stores in current some void * pointer.

  • 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-12T00:15:17+00:00Added an answer on June 12, 2026 at 12:15 am

    The error message is clear enough: you are passing a struct auth ** where a void ** was accepted. There is no implicit conversion between these types as a void* may not have the same size and alignment as other pointer types.

    The solution is to use an intermediate void*:

    void *current_void;
    struct auth *current;
    
    gl_list_iterator_next(&it, &current_void, NULL);
    current = current_void;
    

    EDIT: to address the comments below, here’s an example of why this is necessary. Suppose you’re on a platform where sizeof(struct auth*) == sizeof(short) == 2, while sizeof(void*) == sizeof(long) == 4; that’s allowed by the C standard and platforms with varying pointer sizes actually exist. Then the OP’s code would be similar to doing

    short current;
    long *p = (long *)(&current);  // cast added, similar to casting to void**
    
    // now call a function that does writes to *p, as in
    *p = 0xDEADBEEF;               // undefined behavior!
    

    However, this program too can be made to work by introducing an intermediate long (although the result may only be meaningful when the long‘s value is small enough to store in a short).

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

Sidebar

Related Questions

Given the following C source code: const int foo(void) { return 42; } gcc
In the following program, the line 5 does give overflow warning as expected, but
Got the following warning output when using GCC 4.5.0 & MinGW. Warning: .drectve `-aligncomm:___CTOR_LIST__,2
I know this is wrong and gcc will give you a warning about it,
The following gives an Internal Compiler Error on MSVC++ 10 Sp1. And on gcc:
Following code does compile in gcc 4.5 but it is not being compiled in
I'm aware of this question which mentions Boost's STATIC WARNING, but I'd like to
Compiling with gcc 4.4.3 on Ubuntu 10.04.2 x86_64 I get the following warning: warning:
Here is a piece of code: #include <stdio.h> #include <stdarg.h> void MyPrintf(char const* format,
Consider the following code: #include <iostream> struct A { const char *name; A() :

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.