AnsweredAssumed Answered

Possible 21469 compiler error

Question asked by MikeSmithCanada on Mar 3, 2011
Latest reply on Mar 3, 2011 by dsmtoday

If I have main.cpp

 

float left[5000];
pm float right[5000];

 

void    PrintAsArray(void);
void     PrintAsPointers(void);
   
void main(void) {
    PrintAsArray( );
    PrintAsPointers( );
}

 

and PrintAsArray.cpp

 

extern float left[];
extern pm float right[];

void    PrintAsArray(void) {
    printf("Extern declared as array %x %x\n", &left[0], &right[0]);
}

 

and

PrintAsPointers.cpp

 

extern float *left;
extern pm float *right;

void    PrintAsPointers(void) {

    printf("Extern declared as pointers %x %x\n", &left[0], &right[0]);
}

 

I would NOT have expected the following result

 

Extern declared as array b2012 c0000
Extern declared as pointers 0 0

 

Is this a compiler error -- or am I taking the equivalence of  the pointer left and &left[0] too far?

 

 

Mike Smith

Outcomes