Re: bug in visual studio .net 2003 - breakpoints and memcpy
- From: "Eugene Gershnik" <gershnik@xxxxxxxxxxx>
- Date: Sun, 17 Jul 2005 10:06:59 -0700
Alexander Grigoriev wrote:
> According to ANSI C and standard C++, there is no standard conversion
> from a function pointer to void*, and vice versa. It's just not
> listed among the possible conversions.
Sounds like "undefined by omission" to me. Unless the standards explicitly
forbid what is not allowed (I don't have copies to check). 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.
> A function pointer can be
> converted to an integer of an appropriate size, though, which you may
> (or may not) be able then convert to a void* (the size of the
> necessary integer may be different from the required void* size).
Now this is something I would definitely avoid doing. If a direct cast works
it works. Otherwise the conversion is an error and the "double cast" doesn't
help.
--
Eugene
http://www.gershnik.com
.
- Follow-Ups:
- 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: Alexander Grigoriev
- 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
- 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: how to invoke VirtualProtect() from kernel
- 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
|