From 133b43a5217bb5e27bced051732443f474610b9c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 May 2023 13:43:56 +0000 Subject: Better version, keeping the (undocumented) behavior of 'i' initialization --- generic/tclOOInt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 8a19f74..0b49359 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -590,11 +590,11 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr); * A variation where the array is an array of structs. There's no issue with * possible NULLs; every element of the array will be iterated over and the * variable set to a pointer to each of those elements in turn. - * REQUIRES DECLARATION: int i; + * REQUIRES DECLARATION: int i; See [96551aca55] for more FOREACH_STRUCT details. */ #define FOREACH_STRUCT(var,ary) \ - if ((ary).num > 0) for(i=0; var=&((ary).list[i]), i<(ary).num; i++) + i=0; if ((ary).num > 0) for(; var=&((ary).list[i]), i<(ary).num; i++) /* * Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS -- cgit v0.12