This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warning 167(-D) on const type * versus type *

I have a sourcecode like:

typedef int tQ32_16;
typedef tQ32_16 tVector3[3];

tQ32_16 Length_V3(const tVector3 * vec) {....;}

void anyfunc(void)
{

tVector3 v1 = {1,2,3}; tQ32_16 l1;

l1 = Length_V3(&v1); //==>> warning: #167-D: argument of type "tVector3 *" is incompatible with parameter of type "const tVector3 *"

....
}

Why do I get this warning ??
As far as I know this is correct C-code....

Parents
  • Mike, Thanks.

    Sorry for my very limited C skill. Just want to know if my understanding is correct or not.

    #include <stdio.h>
    
    int Length_V3( int vec[][3] )
    {
        int result = vec[0][0];
    
        return result;
    }
    
    int main(void)
    {
        int v1[1][3] = { { 0xA, 0xB, 0xC } };
        int l1;
    
        l1 = Length_V3(&v1[0]);
        printf( "l1 = %X", l1 );
    
        return 0;
    }
    
    

    Tested with X86/WinXP/Code::Blocks 10.05

    Compiling: C:\WINDOWS\Temp\main_b.c
    Linking console executable: C:\WINDOWS\Temp\main_b.exe
    Process terminated with status 0 (0 minutes, 0 seconds)
    0 errors, 0 warnings
    
    l1 = A
    Process returned 0 (0x0)   execution time : 0.016 s
    Press any key to continue.
    

Reply
  • Mike, Thanks.

    Sorry for my very limited C skill. Just want to know if my understanding is correct or not.

    #include <stdio.h>
    
    int Length_V3( int vec[][3] )
    {
        int result = vec[0][0];
    
        return result;
    }
    
    int main(void)
    {
        int v1[1][3] = { { 0xA, 0xB, 0xC } };
        int l1;
    
        l1 = Length_V3(&v1[0]);
        printf( "l1 = %X", l1 );
    
        return 0;
    }
    
    

    Tested with X86/WinXP/Code::Blocks 10.05

    Compiling: C:\WINDOWS\Temp\main_b.c
    Linking console executable: C:\WINDOWS\Temp\main_b.exe
    Process terminated with status 0 (0 minutes, 0 seconds)
    0 errors, 0 warnings
    
    l1 = A
    Process returned 0 (0x0)   execution time : 0.016 s
    Press any key to continue.
    

Children
No data