I agree with them in a practice is more help this way when you try to check you own code i never use the other way
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Gisle Aas Sent: Thursday, July 01, 2004 11:33 AM To: $Bill Luebkert Cc: [EMAIL PROTECTED] Subject: Re: ++$counter or $counter++? "$Bill Luebkert" <[EMAIL PROTECTED]> writes: > Dominic Pain wrote: > > > 'noon, > > > > Just having a quick discussion about coding style. I say ++$counter, > > whereas another programmer says $counter++. He says that, in C, the second > > form is actually slightly quicker. > > > > Is this also true in Perl, does anyone know? > > You can always benchmark it, but it's not about speed. Both will in void context compile to exactly the same code so there is no speed difference. I can't image that a modern C compiler will do any worse. > I always use $counter++ because it's more intuitive. I too find $counter++ easier to read and always use that form in my code. That form also seems to be natural culmination of this sequence: $counter = $counter + 1; $counter += 1; $counter++; Regards, Gisle Aas _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
