This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA-v2] testsuite: Avoid auto-import warning on cygwin/mingw


>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:

>> 'foreach opt $options {' 

Pedro> Hmmm, I would have thought that foreach would still
Pedro> only iterate over the original elements of $options (since foreach
Pedro> takes the values of $options, not the variable reference),
Pedro> no matter if you lappend to options; or am I confused, and
Pedro> does it really keep iterating over newly append items?

You are not confused -- you are correct about this.
"$options" is substituted when the statement is parsed, not on each loop
iteration.

Tom


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