This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v2][PATCH] Framework for performance benchmarking of functions


On 01/11/2013 07:58 AM, Siddhesh Poyarekar wrote:

+if ($#ARGV lt 1) {
+  die "Usage: bench.pl <function> <iterations> [parameter types] [return type]"
+}

This should be:


if (@ARGV < 2) {

@ARGV in a scalar context results in the array length, and I think it's more idiomatic than $#ARGV (which evaluates to the index of the last element). You compare numbers, so you should use </>/== instead of lt/gt/eq (which are for strings). If there are more than 10 arguments, this is not just style issue because 10 lt 2 is true, while "10" < "2" is not.

(Similar issues follow.)

--
Florian Weimer / Red Hat Product Security Team


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]