* Big compiler bug with VC++5.0 SP2 on alpha
@ 1997-10-11 4:00 Gilles Vollant
0 siblings, 0 replies; only message in thread
From: Gilles Vollant @ 1997-10-11 4:00 UTC (permalink / raw)
Just save the sample included.
Compile with
cl /Zp1 /Od bug.cpp
and it will not perform as needed !
/* -------------------------------------------------------------------------
*/
//Save this file under name bug.cpp, compile vith Visual C++ 5.0 SP2
DecAlpha
// "cl /Zp1 bug.cpp" -> BAD RESULT
// "cl /Zp1 /Od bug.cpp" (or any other platform) -> GOOD RESULT
/* -------------------------------------------------------------------------
*/
#include <Windows.h>
#include <WindowsX.h>
#include <stdlib.h>
#include <stdio.h>
class MINICLASS
{
protected :
LPVOID lpv;
private :
// If we remove the "WORD toto", there is no bug
WORD toto;
protected :
DWORD hWndMap;
LONG ListID;
public :
MINICLASS(){ };
virtual ~MINICLASS(){ };
DWORD GetWndMap() { return hWndMap; };
BOOL SetMap(DWORD hWndMap);
LONG GetListID() { return ListID; };
void SetListID(LONG lListID);
};
DWORD GetBrowserMapWindow(MINICLASS* lpAux)
{
DWORD hWndResult=NULL;
if (lpAux)
{
if (lpAux->GetListID()<0)
hWndResult=49;
else
hWndResult=lpAux->GetWndMap();
};
return hWndResult;
};
void MINICLASS::SetListID(LONG lListID)
{
ListID=lListID;
}
BOOL MINICLASS::SetMap(DWORD SethWndMap)
{
hWndMap = SethWndMap ;
return TRUE;
}
void main()
{
MINICLASS br;
br.SetListID(-3); // lpAux->GetListID() will return -3
br.SetMap((DWORD)-4); // lpAux->GetWndMap() will return -4
DWORD dwRes=GetBrowserMapWindow(&br);
if (dwRes==49)
printf("GOOD RESULT - resultat correct\n");
else
printf("BAD RESULT - compiler bug - resultat mauvais\n");
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-10-11 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-10-11 4:00 Big compiler bug with VC++5.0 SP2 on alpha Gilles Vollant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox