Re: subtracting two pointers to same function ? by Victor
Victor
Thu Apr 21 23:06:23 CDT 2005
IceColdFire wrote:
> Indeed...your explanation is correct...However here is the snippet
> from the C++ standard clause Point 8, as
>
> "If the value 0 is added to or subtracted from a pointer value, the
> result compares equal to the original"pointer value. If two pointers
> point to the same object or function or both point one past the end
> of the"same array or both are null, and the two pointers are
> subtracted, the result compares equal to the value 0"converted to the
> type ptrdiff_t."
>
> the 3rd line in above para says 'function'....this issue has been too
> complex....
> Kindly suggest.
First of all, it's "two pointers to the _same_ function", so it's a bit
different from your original premise of "two pointers to functionS".
Second, if the Standard contains two statements, one direct (in our
case allowing only pointers to objects to participate in additive ops)
and another one indirect, then the direct one precedes.
Third, it has been already reported as a defect (issue 179) and resolved
by removing "or functions" in TC1. I guess this makes the 'first' and
the 'second' irrelevant.
V
P.S. Please don't top-post. Thanks.