My current project is to build a Motorola 6809 emulator.
I started out compiling to a MEGA but just changed to a Due and found a few compiler issues.
Explicitly, the use of a leading underscore character for variable names. This is standard behaviour in naming private variables in a class. I used _PC, _X, _Y, _A, _B etc. The complier complained about _X and _Y and _A. _PC and _B seemed acceptable.
I read that the use of an underscore with a capital letter is a no-no, so I changed the uppercase letters to lower case and aren't getting any more compiler errors.
I wonder why compilation on a MEGA works but not on a Due?
It is not standard but acceptable. If you used them in a class like you said you wouldn’t have had any conflicts, you must have made them global and they clashed with Arduino libraries
Alas, if some other include file has #define'ed a symbol like _X, that will screw up its use even within a class.
For example, the ctype.h file contains #define _X 0x100
If you then have:
class my3dObjectClass {
int _X, _Y, _Z;
:
it will expand to
int 0x100, _Y, _Z;
which of course is not valid.
As a workaround, you could put #undef _X and etc after your include files (or at the beginning of your sketch.) If you're not using the ctype features, you don't really need those defined. (and if you DID need them, you'll get other error messages!)
Certain sets of names and function signatures are always reserved to the implementation:
Each name that contains a double underscore __ or begins with an underscore followed by an uppercase
letter (2.12) is reserved to the implementation for any use.
Each name that begins with an underscore is reserved to the implementation for use as a name in the
global namespace.