Alan B. Pearce escreveu: >> For example, C code might be: >> >> if (i =3D j + k) l =3D 5; >> = A really good compiler will give a warning about the assignment inside the "if", suggesting to use parenthesis around the expression to ensure the programmer really wants the assignment and don't just forgot an "=3D" sign. >> The Pascal equivalent would have to be written as two statements: >> >> i :=3D j + k; >> if i <> 0 then l :=3D 5; >> = I think the reason the C language authors chose such constructs (assignment to be expressions) is because the compilers were not intelligent enough at the time to re-use the just calculated expression. This way, the programmer "helps" the compiler to optimize the code. > The guy that wrote the book that Microchip supplies, 'Beginners Guide to = > Embedded C Programming' (Microchip stock number BK0003) takes the latter = > approach, but reading through the book, it is clear that it is because of = > his lack of understanding of C (other constructs he uses throughout the b= ook = > reinforce this view). = > = I know many people that program in C but advice not using certain constructs. They think these constructs make the logic hard to understand. I agree with them to a certain degree but I like to write my code in a concise manner. This is one of the positive points of C language: if you don't like some elements, don't use them, it is highly flexible and supports many coding styles. Regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist