Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: "Eugene Gershnik" <gershnik@xxxxxxxxxxx>
- Date: Sun, 17 Jul 2005 12:45:21 -0700
Alexander Grigoriev wrote:
> The standard need not list all cases to disallow them.
Well I don't have the standards to argue. What I know is that there is a
general principle "all which is not explicitly mentioned is undefined". No
idea whether it applies in this case.
In any case I think arguing about the standard is besides the point. On
platforms where it makes sense, all most widely used compilers allow the
conversion (sometimes with a warning). Some system APIs (Win32, Posix)
prescribe that the conversion must work. See for example GetProcAddress()
and dlsym(). De-facto this is undefined behavior with clear definitions on
Win32 and Posix. The C and C++ standards can either mark it as such or be
out of sync with reality.
> A function pointer may have a special format on some architectures
> and may not even have a real address inside. Or the code address
> space may be different from data space (and have different
> organization altogether).
Note that these are two different issues. The first issue completely
prohibits the conversion while the second only restricts what you can do
with the converted value. I beleive Ivan Brugiolo meant something like the
second restriction on IA64 (but I may be wrong). In any case the fact that
certain architectures prohibit the conversions doesn't mean that the
conversion has to be prohibited *everywhere*.
> I've worked with a programmer who was keeping calback pointers in
> void*. Couldn't convince him to use properly defined pointer.
Well this is a different issue. If all you have is a function pointer you
should call it 'function pointer'. The interesting question is what should
GetProcAddress return?
--
Eugene
http://www.gershnik.com
.
- Follow-Ups:
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Alexander Grigoriev
- Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: Gareth Haslip
- 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: Alexander Grigoriev
- bug in visual studio .net 2003 - breakpoints and memcpy
- Prev by Date: Re: bug in visual studio .net 2003 - breakpoints and memcpy
- 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
|