Re: VC6.0 SP6 BUG ?



Hi,

I Installed VC6.0 and SP6 and found this problem, it there any one can
explain it?
To see the problem, compile this code fregment with "release mode",
switch any #if option to 0. The AfxMessageBox() show only one once!

void test()
{
#define countof(a) (sizeof(a)/sizeof(a[0]))

int map[4];
int mapcount = countof(map);

#if 1
for(int j=0; j<countof(map); j++)
#else
for(int j=0; j<mapcount; j++)
#endif
{
if(j< (mapcount/2) ){
int deep = (mapcount/2)-j;
deep*=20;
map[j] = deep;
}
else{
int height = j-(mapcount/2);
#if 1
height*=20;
#endif

#if 1
map[j] = height;
#endif
}

CString str;
str.Format("j=%d", j);
AfxMessageBox(str);
}
}

Yep, same for me: one messagebox only. If you turn optimization off, then it works correctly. Seems to be an optimizer bug.

--
SvenC

.



Relevant Pages


Loading