delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/21/09:45:17

Message-ID: <01BD55A9.607116A0@a2.ika.advacom.com.pl>
From: Robert ARSENIUK <arsen AT friko2 DOT onet DOT pl>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: DJGPP and templates
Date: Sun, 22 Mar 1998 15:39:01 +0100
Mime-Version: 1.0

Hi,

I have some source from http://www.relisoft.com/ (great place for Win32), but I can't compile them under RSXNTDJ. Probably problem is in templates :

Functions are defined like this :
template <class T>
inline T GetWinLong (HWND hwnd, int which = GWL_USERDATA)
{
    return reinterpret_cast<T> (GetWindowLong (hwnd, which));
}

template <class T>
inline void SetWinLong (HWND hwnd, T value, int which = GWL_USERDATA)
{
    SetWindowLong (hwnd, which, reinterpret_cast<long> (value));
}

and later used :

.....(code fragment)

	// Pointer to Controller is stored in Window
    Controller * pCtrl = GetWinLong<Controller *> (hwnd);		// line a

    switch (message)
    {
    case WM_CREATE:
        try
        {
            pCtrl = new Controller (hwnd, (CREATESTRUCT *) lParam);
			// Store pointer to Controller inside Window
            SetWinLong<Controller *> (hwnd, pCtrl);			// line b
        }

during compile I.ve got a messages (for line a, b and other) :

parse error before '*'

Is it standard template construction or VC++ specific?

Thanks.

Ps. Sorry for my English.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019