Topic: conversion of (ptr to member) to int or bool
Author: alan@vedge.com (Alan Rooks)
Date: Mon, 06 Dec 1993 17:48:32 GMT Raw View
In the places where a truth value is required, the ARM states that
an arithmetic type or pointer is required. (See sections describing
the !, &&, ||, ?: operators, and if and looping statements).
The recent "executive summary" of the new bool type states that numeric
and pointer values are automatically converted to bool.
Shouldn't "arithmetic and pointer types" be changed to "arithmetic, pointer,
and pointer to member types" in these contexts? 0 is defined to be a special
pointer to member that points to nothing, so in this sense pointers to members
act the same as ordinary pointers.
Note that the ARM states fairly explicitly that pointers to members are NOT
pointers, so "pointer to member" cannot be assumed when "pointer" is written.
For example, the equality operators explicitly state that pointers to members
may be compared, in addition to arithmetic and pointer types.
--
Alan Rooks Visual Edge Software, St-Laurent (Montreal)
alan@vedge.com or alan%vedge.uucp@iros1.iro.umontreal.ca
Author: dag@control.lth.se (Dag Bruck)
Date: 9 Dec 1993 07:19:35 GMT Raw View
In <comp.std.c++> alan@vedge.com (Alan Rooks) writes:
>
>The recent "executive summary" of the new bool type states that numeric
>and pointer values are automatically converted to bool.
>
>Shouldn't "arithmetic and pointer types" be changed to "arithmetic, pointer,
>and pointer to member types" in these contexts? 0 is defined to be a special
>pointer to member that points to nothing, so in this sense pointers to members
>act the same as ordinary pointers.
This makes sense at a first glance; I will look into it. Don't expect
any immediate progress though.
-- Dag