??? 05/19/06 12:16 Read: times |
#116635 - Sometimes even using things for "what it Responding to: ???'s previous message |
"#ifdef #if are not 'helpers', they are 'unavoidable nuisances', the more you have, the more unreadable your code becomes."
True if used (excessively) inside the code, but I think in this case the use is exactly what it was meant for. Sometimes even using things for "what it was meant for" can be counterproductive. Just see your little 'example' It is virtually unreadable. My means of #ifdef reduction is in the build files, e.g. My build file select mainco.c and rename it main.c if the build is for color. I do not know if thinking along this line will give you any ideas, but here it is. "SFR16 is the death of many efforts. E.g. for the PCA the sequence of writing high and low is critically important, how do you propose handling that for requirements that vary (some A/Ds require the opposite?." It's even worse as this is sometimes true within one mcu for different registers (f.e. F120 MAC0B vs. DAC0). Unfortunately I have no solution for that yet. The solution is dead seimple remove it. Oh, I see, you can't do that because that would force the coders (deliberately I do not use 'programmers') to think and we can not have that, can we? Erik |