Hi Vasile, > The question is: can the if-end if be changed with something else (case > of?). There is a major benefit of using "case of" instead of long if ...end > if for long programs? If-statements can act on any expression like (a>b) and each if can have an other expression. For swicht/case, there is only one expression that is evaluated and the result is compared with fixed values. Despite this limitation, I use switch/case a lot because I find it much easier to keep the overview of the code.
I can't think of a reason why long if/endif statements would cause trouble with JAL. Which one is most effective (in speed and/or code size) should be easy tested - just study the asm code generated. I expect the article advices switch/case over if/else chains since it assumes the compiler generates a jump table. Iirc there was a discussion between Gordon and Kyle not too long ago which made clear that the JAL compiler does not. So don't expect too much improvement. This is true for many optimisation advises in this article (register use, local variables, cache): they relate to behavior of C compiler code generation and processors that are much more complex than PICs. B.t.w.: IMO the most important pattern is in part one of this article: Premature Code Tuning Avoided 'Code complete' - the book mentioned - however is one of the best books on software design I've read. And even though the examples are mostly (all?) C, most of the book also applies on JAL development. Joep -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
