This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What's the difference between (*(x)).a and (x)->a


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]