Declaring local variables inside loop
- From: Hendrik Maryns <hendrik_maryns@xxxxxxxxxxxxx>
- Date: Wed, 22 Feb 2006 12:54:50 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message
Hi,
I do some looping like this:
FunctionInputTuple tupleWithSecond;
while (tupleStates.contains(first)) {
tupleWithSecond = FunctionInputTuple.getInstance(
tuple.getSymbol(), tupleStates);
// do some computation, replace ?first? in the list
equivalent &= equivalence.equivalent(firstValue,
secondValue);
}
Now my question is: does it matter that I declare tupleWithSecond
outside the loop? I have the impression that if I leave the first line
out and instead add ?FunctionInputTuple? before the third line, that a
new pointer space is created on the stack for each loop. Or is the
compiler smart enough to see this and optimise it away?
TIA, H.
--
Hendrik Maryns
==================
www.lieverleven.be
http://aouw.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFD/FEKe+7xMGD3itQRApCNAJ0XAuO9EDzcPLMU+drVSb+7GWuRlwCeMLlI
8DO6B188P50x4WNYLLIx5MQ=
=PA5B
-----END PGP SIGNATURE-----
.
- Follow-Ups:
- Re: Declaring local variables inside loop
- From: Biswajit Biswal
- Re: Declaring local variables inside loop
- From: Roedy Green
- Re: Declaring local variables inside loop
- From: Adam Maass
- Re: Declaring local variables inside loop
- From: Ed
- Re: Declaring local variables inside loop
- From: opalpa@xxxxxxxxx opalinski from opalpaweb
- Re: Declaring local variables inside loop
- From: Chris Uppal
- Re: Declaring local variables inside loop
- From: Jacob
- Re: Declaring local variables inside loop
- From: tom fredriksen
- Re: Declaring local variables inside loop
- Prev by Date: Re: The best data structure
- Next by Date: Re: Windward Reports
- Previous by thread: JNI with packages
- Next by thread: Re: Declaring local variables inside loop
- Index(es):
Relevant Pages
|