Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: "Slava M. Usov" <stripit.slough@xxxxxxx>
- Date: Tue, 19 Jul 2005 02:41:20 +0200
"Eugene Gershnik" <gershnik@xxxxxxxxxxx> wrote in message
news:OVcIFZ%23iFHA.3012@xxxxxxxxxxxxxxxxxxxxxxx
[...]
> What you have missed is this
>
> <quote>
> In any case even
> if the standards explicitly disallowed such casts this would be just a
> case of useless and pointless standard restriction. If it works on certain
> platforms but not others the behavior should be undefined.
> </quote>
>
> The Win32 and Posix example was about the later issue. For whatever reason
> you took it to be a continuation of the orginal claim. Had you actually
> read what I have written we probably could have avoided this whole
> exchange.
I did read that. I disagree. And I am not alone here. The "committee
members" also say that the intent is to make it perfectly well defined when
the conversion can be supported and also perfectly well defined
[=ill-formed] when it cannot be supported. You seem to want it just
undefined, as in C. I do not regard that as an improvement -- and the
"committee members" are not likely to regard it that way, too, given that
the feature was knowingly removed during standardization.
[...]
> Consider the following extremely portable function and its usage. If you
> don't like the types involved please suggest a better approach.
>
> void * GetExportAddress(dll_handle_t h, const char * name)
> {
> #ifdef _WIN32
> return (void*)::GetProcAddress(h, name);
> #elif defined(POSIX)
> return ::dlsym(h, name);
> #else
> #error Yadda yadda
> #endif
> }
>
>
> typedef void func();
>
> func * pf = (func*)GetExportAddres(h, "func");
> pf();
If you drop ::, it will be Standard C with undefined behaviour, which will
nevertheless work OK by the virtue of the implementation. Which makes it
portable just between win32 and POSIX. If you leave ::, it will be
non-standard C++, with the same properties. Either way its use is safe and
well-defined on the above mentioned platforms. I like the return type of
basic GetProcAddress() better than that of the wrapper or dlsym(), because
the former does not require C++ extensions [or future
conditionally-supported something] in typical use and it generally "means
what it says". I like the name of dlsym() better than that of Get*Address()
[win32 naming is just horrible; NT naming is a tad better because it is
slightly more systematic, but still inadequate].
So, basically, it is all broken. Seemingly, beyond repair.
S
.
- Follow-Ups:
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- References:
- bug in visual studio .net 2003 - breakpoints and memcpy
- From: Gareth Haslip
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Alexander Grigoriev
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Alexander Grigoriev
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Slava M. Usov
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Slava M. Usov
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Slava M. Usov
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Slava M. Usov
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Eugene Gershnik
- bug in visual studio .net 2003 - breakpoints and memcpy
- Prev by Date: Re: Canonical names for kernel objects
- Next by Date: Re: bug in visual studio .net 2003 - breakpoints and memcpy
- Previous by thread: Re: bug in visual studio .net 2003 - breakpoints and memcpy
- Next by thread: Re: bug in visual studio .net 2003 - breakpoints and memcpy
- Index(es):
Relevant Pages
|