> On Dec 2, 2015, at 23:03, Jens Alfke <j...@mooseyard.com> wrote:
> 
> 
>> On Dec 2, 2015, at 10:41 PM, Clark Cox <clarkc...@gmail.com> wrote:
>> 
>>>     Widget *w = factory.getCurrentWidget();
>>>     Paint *p = w->getPaint();
>>> If the currentWidget is NULL, the second line does this.
>> 
>> That counts as a pointer dereference (the special case of &*foo is just 
>> that, a special case).
> 
> It syntactically looks like one, but it isn’t one. “Dereference” means 
> referencing, i.e. accessing, the memory location pointed to. A nonvirtual 
> method call doesn’t do that. 
> 

The C++ standard disagrees with you. 

> 6.5.3.2 Address and indirection operators
> …

(Special case for &* that you mentioned before):

>  3  The unary & operator yields the address of its operand. If the operand 
> has type ‘‘type’’, the result has type ‘‘pointer to type’’. If the operand is 
> the result of a unary * operator, neither that operator nor the & operator is 
> evaluated and the result is as if both were omitted, …
> …

Meat of the matter:

> 4 The unary * operator denotes indirection. If the operand points to a 
> function, the result is a function designator; if it points to an object, the 
> result is an lvalue designating the object. If the operand has type ‘‘pointer 
> to type’’, the result has type ‘‘type’’. If an invalid value has been 
> assigned to the pointer, the behavior of the unary * operator is 
> undefined.102) 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to