Quote Originally Posted by it-ogo View Post
Code:
#define self this
idLang operator ++(idLang &, int);

//etc...
Ok... then:

Code:
Esperanto::Esperanto() { 
  char* dest=(char*) self; 
  idLang Lang=idEnglish;
  while(dest-(char*)self<=sizeof(*self)) {
    *dest++*= *(((char*)&::Languages[Lang])+rand()%sizeof(Languages[Lang]));
    if (++Lang > idChinese) Lang=idEnglish;
  }
  for(int i=0; i<nRules; i++) if (GrammarRules[i]->Size>3) GrammarRules[i]=NULL;
}
But:

1. No code like "this*", in this case macros won't let you get away with a syntax error.
2. No code like "<pointer_name>*" when dereferencing the pointer. That's just wrong and gives you a syntax error as well.
3. It's generally recommended you define return types of such overloaded operators as "<class_name>&", ie:
Code:
idLang& operator ++(idLang &, int);
That allows you to avoid an unnecessary (and potentially expensive) call of the copy constructor.