Hi all, I have a code already written on an 8051 based controller, in which I am enabling some features through Preprocessor Directives. In that process, I am struck at the following error.
C51 COMPILER V7.50 - SN: K1DQP-01744E COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2004 C51 FATAL-ERROR - ACTION: PARSING SOURCE-FILE ERROR: PREPROCESSOR: MACROS TOO NESTED C51 TERMINATED.
Kindly let me know what does this error mean and how to rectify this? Awaiting your reply. Regards, Balaji
NEVER-EVER use macros to do more than a very-very simple thing like:
abs( x ); -or- max( x, y );
I once saw [a retard's] code in which he used macros everywhere. I then chose to ban all macros in the company (my rule-book).
The only exception is if the code-monkey obtains a waiver from either the customer, or project manager.
And yes I know there can be a fine-line between a #define and a macro.
I don't think you are saving much time when implementing [nested] macros: errors can be hard to track down too.
--Cpt. Vince Foster 2nd Cannon Place Fort Marcy Park, VA
There are macros that make code more readable and there are macros that makes it non-readable, non-debuggable, non-...
It seems that there are two principal directions a) no macros and b) too many macros.
I lean towards a use of macros for exceptions only e.g. if a function is entered with e.g. a variable that is too large it will call PGM_ERR().
Erik
"I then chose to ban all macros in the company (my rule-book)."
I take it you don't drink alcohol, then?
Toward the bottom you'll see that I do drink alcohol from time to time.
http://www.keil.com/forum/docs/thread15341.asp
15mg Hydrocodone, 650mg of APAP, 20mg Diazapam, 350mg of Cordosiporol, 1.5 shots of Bacardi 151, one "Rules for Coding [Monkey] Radicals," one fulll lip of Copenhagan, and bio-lab bunker level #3 with elevated O2 levels. Yet I still function at a higher strata than a sardine: 999.