This code:
#define DEREF(ptr) (*ptr)
MyClass *pClass = new MyClass;
DEREF(pClass).foo(); // equivalent of (*pClass).foo() or simply pClass->foo()
Can I configure the #define macro to accept the ptr parameter as the word that follows the macro instead of bracketed statement, so that I can do the following?:
DEREF pClass.foo();
No, C macros can only receive parameters inside brackets ‘()’