Re: not really a MFC question
You could temporarily put the macro inline to see which line causes the
error but I suspect the last one.
I really dislike macros like this. It makes it many times harder to figure
out what is going on. But it appears the last definition in the macro will
result with:
void link (const void *, unsigned long);
Whereas the declaration on the line before the macro is:
void link (const void *, size_type);
Depending on your platform and settings, I would say unsigned long and
size_type are most likely indistinguishable, if not identical.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"mosfet" <john.doe@anonymous.org> wrote in message
news:46b9aa0c$0$24133$426a74cc@news.free.fr...
Hi,
maybe not the best thread to post but here is my question :
I am trying to compile a light version of STL called ustl on win32 but I
get the following errors :
1>c:\program files\microsoft visual studio
8\vc\include\ustl\cmemlink.h(61) : error C2535: 'void
ustl::cmemlink::link(const void *,ustl::cmemlink::size_type)' : member
function already defined or declared
1> c:\program files\microsoft visual studio
8\vc\include\ustl\cmemlink.h(60) : see declaration of
'ustl::cmemlink::link'
When i look at source code I find :
void link (const void* p, size_type n);
OVERLOAD_POINTER_AND_SIZE_T_V2(link, const void*)
and
...
#ifdef SIZE_T_IS_LONG
#define NOT_SIZE_T_I_OR_L unsigned int
#else
#define NOT_SIZE_T_I_OR_L unsigned long
#endif
/// \brief Required when you want to overload size_t and a pointer.
///
/// The compiler will happily cast a number to a pointer and declare
/// that the overload is ambiguous unless you define overloads for all
/// possible integral types that a number may represent. This behaviour,
/// although braindead, is in the ANSI standard, and thus not a bug. If
/// you want to change the standard, the best solution is to disallow any
/// implicit casts to pointer from an integral type. Ironically, such an
/// implicit cast is already detected by gcc.
///
#define OVERLOAD_POINTER_AND_SIZE_T_V2(name, arg1type) > inline void name (arg1type a1, short a2) { name (a1, size_t(a2)); } > inline void name (arg1type a1, unsigned short a2) { name (a1,
size_t(a2)); } > inline void name (arg1type a1, int a2) { name (a1, size_t(a2)); } > inline void name (arg1type a1, long a2) { name (a1, size_t(a2)); } > inline void name (arg1type a1, NOT_SIZE_T_I_OR_L a2) { name (a1,
size_t(a2)); }
} // namespace ustl
Any idea ?
Seems like const void* is considered as something else ...