What's the difference between (*(x)).a and (x)->a
John (Eljay) Love-Jensen
eljay@adobe.com
Wed Jan 21 14:18:00 GMT 2009
Hi John,
> Can they be different in C++ ?
>
> A key phrase in the question is "x is an expression which generates a
> struct pointer."
>
> You can overload the meaning of * or -> if x is a struct. I thought you
> couldn't overload them if x is a pointer.
I can't think of any way of overloading operations on a pointer -- struct
pointer or any other sort of pointer. All pointers are POD.
I can think of many ways of overloading operations on an object. Smart
pointers (e.g., std::auto_ptr) are really objects with pointer semantics.
I think you are correct. Good eye and very careful reading... good catch!
Sincerely,
--Eljay
More information about the Gcc-help
mailing list