This is a macro which makes my
an alias for me ->
.
The intended use seems to be so to allow usage of my x
for any member x
given that me
is a pointer to some object. Hence, these two will be equivalent given that macro:
me->x
my x
Most likely, you also have a macro like this, somewhere in the code:
#define me this
which would let you use me
instead of this
in a member function. The intended effect is so that, in any member function of a class with member x
, these two are equivalent:
my x
this->x
and it will unambiguously refer to the member x
of the current instance, even if a local variable with the same name exists - because that's what this->x
does.
That being said, this trick is horrible. It doesn't add anything which isn't already in the language - it only creates a new syntax for something which already has a well-defined and well-known syntax.
Also, by virtue of being a macro, it will very easily break perfectly valid code. For example,As soon as someone tries to declare a variable of type int
called my
, this macro could lead to very confusing error messages, as the actual code generated is:
// This is what is written:
int my;
// This is what it becomes:
int me ->;
// Unless the #define for me is available, in which case you get:
int this ->
My tip, and it seems from other comments as if there's a strong consensus: Avoid this macro and, if possible, delete it and replace all its uses by an ordinary member access.
The only reason I could think of to have such a macro would be in a translation layer for some other language in which me
actually means the same as this
in C++ and my
is the same as this ->
. So unless this is part of some lightweight language translation layer used on top of a C++ compiler, it needs to be removed.