Ironclad C++

Timon Gehr timon.gehr at gmx.ch
Sat Aug 3 19:08:14 PDT 2013


On 08/04/2013 04:06 AM, Walter Bright wrote:
> On 8/3/2013 5:49 PM, Timon Gehr wrote:
>> On 08/04/2013 01:55 AM, Walter Bright wrote:
>>> On 8/3/2013 4:32 PM, bearophile wrote:
>>>> The paper explains the various cases: assign from ptr<T> into lptr<T>,
>>>> assign
>>>> from lptr<T> into ptr<T>, and assign from lptr<T> into lptr<T>.
>>>>
>>>> So with a mix of run-time tests and a small amount of static analysis
>>>> the code
>>>> is safe and fast enough. It seems a simple enough idea.
>>>
>>> The problem with different pointer types is, of course, what do you do
>>> with functions that take pointers as arguments?
>>>
>>
>> Why would that be a problem?
>
> Consider the canonical example:
>
>      void* foo(void *p) { return p; }
>
> Do you write an overload for each kind of pointer?

No, you use lptr<void> because it is the most specialized type that works.


More information about the Digitalmars-d mailing list