Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Gilles Vollant" <info@winimage.com>
Subject: Big compiler bug with VC++5.0 SP2 on alpha
Date: 1997/10/11	[thread overview]
Message-ID: <O96w7In18GA.285@upnetnews02.moswest.msn.net> (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");
}







                 reply	other threads:[~1997-10-11  4:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox