<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Vernestelte for mit gleicher Variable]]></title><description><![CDATA[<p>Dieses Codestückchen gibt für MSVC++ 2010 und g++ 4.4.5 folgendes aus:</p>
<pre><code class="language-cpp">for ( int i=0; i&lt;3; ++i ) {
	std::cout &lt;&lt; i &lt;&lt; std::endl;
	for ( int i=0; i&lt;3; ++i )
		std::cout &lt;&lt; &quot;  &quot; &lt;&lt; i &lt;&lt; std::endl;
}
/* =&gt;
0
  0
  1
  2
1
  0
  1
  2
2
  0
  1
  2
*/
</code></pre>
<p>Ist das Standard-konformes Verhalten? Bzw was sagt der Standard dazu, wenn in verschachtelten for-Schleifen identische Variablennamen verwendet werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/282898/vernestelte-for-mit-gleicher-variable</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 21:52:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/282898.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Feb 2011 21:39:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vernestelte for mit gleicher Variable on Mon, 28 Feb 2011 21:39:15 GMT]]></title><description><![CDATA[<p>Dieses Codestückchen gibt für MSVC++ 2010 und g++ 4.4.5 folgendes aus:</p>
<pre><code class="language-cpp">for ( int i=0; i&lt;3; ++i ) {
	std::cout &lt;&lt; i &lt;&lt; std::endl;
	for ( int i=0; i&lt;3; ++i )
		std::cout &lt;&lt; &quot;  &quot; &lt;&lt; i &lt;&lt; std::endl;
}
/* =&gt;
0
  0
  1
  2
1
  0
  1
  2
2
  0
  1
  2
*/
</code></pre>
<p>Ist das Standard-konformes Verhalten? Bzw was sagt der Standard dazu, wenn in verschachtelten for-Schleifen identische Variablennamen verwendet werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2027875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2027875</guid><dc:creator><![CDATA[bimbam]]></dc:creator><pubDate>Mon, 28 Feb 2011 21:39:15 GMT</pubDate></item><item><title><![CDATA[Reply to Vernestelte for mit gleicher Variable on Mon, 28 Feb 2011 21:41:46 GMT]]></title><description><![CDATA[<p>Ja, das ist standardkonformes, definiertes Verhalten. Du darfst jederzeit Variablennamen aus höheren Skopes benutzen. Die werden dann verdeckt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2027878</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2027878</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 28 Feb 2011 21:41:46 GMT</pubDate></item><item><title><![CDATA[Reply to Vernestelte for mit gleicher Variable on Mon, 28 Feb 2011 21:42:13 GMT]]></title><description><![CDATA[<p>... inner scope ueberdeckt outer scope ... macht aber keinen Sinn und nur unnötig schwer wartbaren Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2027879</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2027879</guid><dc:creator><![CDATA[padreigh]]></dc:creator><pubDate>Mon, 28 Feb 2011 21:42:13 GMT</pubDate></item><item><title><![CDATA[Reply to Vernestelte for mit gleicher Variable on Mon, 28 Feb 2011 21:55:13 GMT]]></title><description><![CDATA[<p>Ok, danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2027885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2027885</guid><dc:creator><![CDATA[bimbam]]></dc:creator><pubDate>Mon, 28 Feb 2011 21:55:13 GMT</pubDate></item></channel></rss>