Hi Jan-Erik, On Sat, Apr 5, 2014 at 6:21 PM, Jan-Erik Soderholm wrote: > I'm no C expert, but here are my views. Me either! > 1. > Dynamic variables (declared within a function and not "static" > will be allocated/freed at each call/return. That might cause > some extra overhead. Variables that are declared at "file level" > (outside of main()) are, AFAIK, automaticly static. The extra > problem with ISR's is that execution flow is not "normal". If > you declare variables within the ISR function, and you want the > values live to the next interrupt, they should be "static", if > not they will be initialized (reallocated) at each interrupt. Ah, excellent point. I hadn't considered that about the ISR. > 2. > That is more of an compiler quetions that the manual should > tell about, I guess. :-) Good point, I will search more in there! > 3. > If the (source) code is hard to follow, it realy doesn't > matter what it will run on when compiled. Hard-to-read source > code is always hard-to-read source code. And that is of course > not something specific to C. :-) > > Your *compiled* C code will probably still have a lot of > GOTO's all over the place, maybe even more then before. > But that is only to implement the higher lever constructs > available in C as "case", "while", "if" and so on. > > Some says that properly written C code will never see any > need for a GOTO... :-) I've run across that as well. I guess as I get more comfortable I will stop reaching for the "crutch" of a goto. > 4. > There is nothing stopping you to continue handling your > peripherials just as before. Any C compiler for PICs should > have syntax for dealing directly with registers and "bits". > It just comes in a nicer "package"... :-) I wonder if it makes my code a bit more portable as well, since if the peripheral macros are defined correctly, they should work automatically when I switch chips. That might be a big "if" though. Thanks! Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .