> -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of Vitaliy > Sent: 26 February 2010 09:25 > To: Microcontroller discussion list - Public. > Subject: Re: [PIC]Function declaration causes error in one > programbutnotanother > > Alan B. Pearce wrote: > >> The 'for' construct is much more concise, elegant > >> and easier to understand. > > > > ;))) Not according to Chuck Hellebuyuk that wrote "Beginners Guide to > > Embedded C Programming" (available through Microchip). He also doesn't > > like > > the ++ and += styles of notation ... > > You know, I use the ++ notation myself, but I choose not to use the += > style > notation, because in my mind it's a C-ism that makes the code less > readable > while offering no real benefit. Maybe it made sense when screens were 80 > characters wide? > > Vitaliy It makes sense to me in the context of a mid-level language; in assembler an add instruction will typically add the value of one register to an accumulator or another register and that's the entire operation e.g. movf b,W addwf a,F which is nicely equivalent to: a += b; The long hand expression implies two distinct operations i.e. the addition itself and the moving of the result: a = b + c movf b,W addwf c,W movwf a The move is clearly redundant when the result is stored in one of the original operands, and obviously no modern compiler worthy of consideration would actually include a redundant move. However I'm wondering if this was helpful for early compilers, i.e. that operation would produce more efficient code without using an optimiser? Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist