It seems, VC++ 2010 have bug with global references to arrays.Got strange results with this code with VC++ 2010 - compiles, but gives wrong results.Tested with C++Builder 2010 and GCC 4.2.4 (on linux) - works just fine.#include <stdio.h>// Simple dataint IntArr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};// Pointer to simple dataint (*IntArrPtr)[10] = &IntArr;// Reference #1 to pointed dataint (&IntArrRef1)[10] = *IntArrPtr;int main(int argc, const char* argv[]){ // Reference #2 to pointed data int (&IntArrRef2)[10] = *IntArrPtr; printf("Data from IntArrRef1: "); for (int i = 0; i < 10; i++) { printf(" %d ", IntArrRef1[i]); } printf("\r\n"); printf("Data from IntArrRef2: "); for (int i = 0; i < 10; i++) { printf(" %d ", IntArrRef2[i]); } printf("\r\n"); return 0;}
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...