<?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[If Verschachtelung, für welches if gilt das else ?]]></title><description><![CDATA[<p>Hey,<br />
Wenn ich einen Code habe der so aussieht:</p>
<pre><code class="language-cpp">if( g_pPlayer == NULL )
	{
		ENVIR_INFO* pInfo = GetInContinent( g_pPlayer-&gt;GetPos( ) );
	    if( pInfo &amp;&amp; m_kCurContinent._bUseEnvir )		// ´ë·ú ¾ÈÀÌ°í ´ë·úÁ¤º¸¸¦ ÀÌ¿ëÇÒ °æ¿ì¸¸ !!
		{
			if( pLight )
			{
				pLight-&gt;Ambient.r =  pInfo-&gt;_fAmbient[ 0 ];
			    pLight-&gt;Ambient.g =  pInfo-&gt;_fAmbient[ 1 ];
			    pLight-&gt;Ambient.b =  pInfo-&gt;_fAmbient[ 2 ];

			    pLight-&gt;Specular.r = 2.0f;
			    pLight-&gt;Specular.g = 2.0f;
			    pLight-&gt;Specular.b = 2.0f;

			    pLight-&gt;Diffuse.r = pInfo-&gt;_fDiffuse[ 0 ];
			    pLight-&gt;Diffuse.g = pInfo-&gt;_fDiffuse[ 1 ];
			    pLight-&gt;Diffuse.b = pInfo-&gt;_fDiffuse[ 2 ];

			    HookUpdateLight( pLight ); 

			    memcpy( &amp;m_lightFogSky, pLight, sizeof( m_lightFogSky ) );

			    pLight-&gt;Diffuse.r *= 1.2f;
			    pLight-&gt;Diffuse.g *= 1.2f;
			    pLight-&gt;Diffuse.b *= 1.2f;

			    pLight-&gt;Ambient.r *= 0.8f;
			    pLight-&gt;Ambient.g *= 0.8f;
		    	pLight-&gt;Ambient.b *= 0.8f;

			    memcpy( &amp;m_light, pLight, sizeof( m_light ) );

 			    D3DXVECTOR3 vecSun = D3DXVECTOR3( 0.0f, 0.5f,0.5f);
 			    D3DXVec3Normalize(&amp;(vecSun),&amp;(vecSun));
 		     	pLight-&gt;SetDir( -vecSun.x, -vecSun.y, -vecSun.z ); 
 		    	pLight-&gt;Appear( m_pd3dDevice, TRUE );

			    DWORD dwR, dwG, dwB;
			    dwR = (DWORD)( pLight-&gt;Ambient.r * 255 );
			    dwG = (DWORD)( pLight-&gt;Ambient.g * 255 );
			    dwB = (DWORD)( pLight-&gt;Ambient.b * 255 );
			    dwAmbient = D3DCOLOR_ARGB( 255, dwR, dwG, dwB );
			}
		}
	}
	else //
</code></pre>
<p>Für welches If gilt das Else am ende und wie ist das generell ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/297066/if-verschachtelung-für-welches-if-gilt-das-else</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 14:32:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/297066.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 18 Dec 2011 15:11:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:11:37 GMT]]></title><description><![CDATA[<p>Hey,<br />
Wenn ich einen Code habe der so aussieht:</p>
<pre><code class="language-cpp">if( g_pPlayer == NULL )
	{
		ENVIR_INFO* pInfo = GetInContinent( g_pPlayer-&gt;GetPos( ) );
	    if( pInfo &amp;&amp; m_kCurContinent._bUseEnvir )		// ´ë·ú ¾ÈÀÌ°í ´ë·úÁ¤º¸¸¦ ÀÌ¿ëÇÒ °æ¿ì¸¸ !!
		{
			if( pLight )
			{
				pLight-&gt;Ambient.r =  pInfo-&gt;_fAmbient[ 0 ];
			    pLight-&gt;Ambient.g =  pInfo-&gt;_fAmbient[ 1 ];
			    pLight-&gt;Ambient.b =  pInfo-&gt;_fAmbient[ 2 ];

			    pLight-&gt;Specular.r = 2.0f;
			    pLight-&gt;Specular.g = 2.0f;
			    pLight-&gt;Specular.b = 2.0f;

			    pLight-&gt;Diffuse.r = pInfo-&gt;_fDiffuse[ 0 ];
			    pLight-&gt;Diffuse.g = pInfo-&gt;_fDiffuse[ 1 ];
			    pLight-&gt;Diffuse.b = pInfo-&gt;_fDiffuse[ 2 ];

			    HookUpdateLight( pLight ); 

			    memcpy( &amp;m_lightFogSky, pLight, sizeof( m_lightFogSky ) );

			    pLight-&gt;Diffuse.r *= 1.2f;
			    pLight-&gt;Diffuse.g *= 1.2f;
			    pLight-&gt;Diffuse.b *= 1.2f;

			    pLight-&gt;Ambient.r *= 0.8f;
			    pLight-&gt;Ambient.g *= 0.8f;
		    	pLight-&gt;Ambient.b *= 0.8f;

			    memcpy( &amp;m_light, pLight, sizeof( m_light ) );

 			    D3DXVECTOR3 vecSun = D3DXVECTOR3( 0.0f, 0.5f,0.5f);
 			    D3DXVec3Normalize(&amp;(vecSun),&amp;(vecSun));
 		     	pLight-&gt;SetDir( -vecSun.x, -vecSun.y, -vecSun.z ); 
 		    	pLight-&gt;Appear( m_pd3dDevice, TRUE );

			    DWORD dwR, dwG, dwB;
			    dwR = (DWORD)( pLight-&gt;Ambient.r * 255 );
			    dwG = (DWORD)( pLight-&gt;Ambient.g * 255 );
			    dwB = (DWORD)( pLight-&gt;Ambient.b * 255 );
			    dwAmbient = D3DCOLOR_ARGB( 255, dwR, dwG, dwB );
			}
		}
	}
	else //
</code></pre>
<p>Für welches If gilt das Else am ende und wie ist das generell ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158372</guid><dc:creator><![CDATA[Miriiam]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:11:37 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:20:36 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">else // g_pPlayer != NULL
</code></pre>
<p>Generell gilt: Zu jeder öffnenden Klammer { gehört eine schließende }.</p>
<p>Bei dem Code ist es auch noch besonders einfach, da er so eingerückt ist, wie es sein sollte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158380</guid><dc:creator><![CDATA[{ }]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:20:36 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:21:25 GMT]]></title><description><![CDATA[<p>In diesem Fall gehört das Else eindeutig zum äußersten If. Die inneren Ifs sind komplett abgeschlossen, da sie von den geschweifen Klammern umgeben sind.</p>
<p>Problematisch wird es, wenn man die Klammern weg lässt (siehe <a href="http://de.wikipedia.org/wiki/Dangling_else" rel="nofollow">http://de.wikipedia.org/wiki/Dangling_else</a>)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158381</guid><dc:creator><![CDATA[Tobiking2]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:21:25 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:23:17 GMT]]></title><description><![CDATA[<p>Danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158383</guid><dc:creator><![CDATA[Miriiam]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:26:44 GMT]]></title><description><![CDATA[<p>Welche IDE nutzt du? Klick mal innerhalb des Quelltexts auf ein { .Normalerweise wird wenn du Syntax-Highlighting aktiviert hast, die schließende Klammer farblich makiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158386</guid><dc:creator><![CDATA[zuckerlie]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:26:44 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:27:52 GMT]]></title><description><![CDATA[<p>Nutze in dem Fall VS2003 kann bei dem Projekt leider keine neuere Version nutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158387</guid><dc:creator><![CDATA[Miriiam]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:27:52 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:34:29 GMT]]></title><description><![CDATA[<p>Ich weiß nicht, wie das mit dem VS ist. Aber eigentlich kann man seine Projekte konvertieren um mit neueren Versionen daran arbeiten zu können oder irre ich mich da?!</p>
<p>Frage nebenbei, du heißt nicht zufällig Cz.... mit Nachnahmen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> //edit: *Nachnamen natürlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158389</guid><dc:creator><![CDATA[zuckerlie]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:34:29 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 15:38:23 GMT]]></title><description><![CDATA[<p>Nein tue ich nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Ja kann man, aber da in dem Projekt vorher mit C gearbeitet wurde und es in C++ umgeschrieben wurde gibts ganz schön viele Errors <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /><br />
Schleifen ..<br />
Da dort noch andere Standarts galten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158392</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158392</guid><dc:creator><![CDATA[Miriiam]]></dc:creator><pubDate>Sun, 18 Dec 2011 15:38:23 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 18:51:45 GMT]]></title><description><![CDATA[<p>Hab schnell noch den Senf geholt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<pre><code class="language-cpp">if( g_pPlayer == NULL )
    {///####-&gt;A

        ENVIR_INFO* pInfo = GetInContinent( g_pPlayer-&gt;GetPos( ) );
        if( pInfo &amp;&amp; m_kCurContinent._bUseEnvir )
        {///####-&gt;B

            if( pLight )
            {///####-&gt;C

                pLight-&gt;Ambient.r =  pInfo-&gt;_fAmbient[ 0 ];
                pLight-&gt;Ambient.g =  pInfo-&gt;_fAmbient[ 1 ];
                pLight-&gt;Ambient.b =  pInfo-&gt;_fAmbient[ 2 ];

                // Restlicher Scheiß

            }///####-&gt;C

        }///####-&gt;B

    }//####/-&gt;A
    else //Gegenüber ####A sonst mach irgendwas anderes, ist mir egal
</code></pre>
<p>Verschachtelt sind die Dinger dann nur in ihrem Namensraum 'gültig', bzw. relevant (oder beeinflussend).</p>
<p>:xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2158472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158472</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 18 Dec 2011 18:51:45 GMT</pubDate></item><item><title><![CDATA[Reply to If Verschachtelung, für welches if gilt das else ? on Sun, 18 Dec 2011 18:52:06 GMT]]></title><description><![CDATA[<p>Zu deinen Schleifen-problemen:</p>
<pre><code class="language-cpp">for(int a = 0;a != 10;++a)
    tuwasmit(a);

nochwasanderesmit(a); ///&lt;--- FEHLER IN C++!!
</code></pre>
<p>Früher waren die im Kopf deklarierten Variablen auch in dem Namensraum in dem die Schleife definiert (oder was auch immer) wurde gültig, also</p>
<pre><code class="language-cpp">{///NAMESPACE BLA

    for(int a = 0;a != 10;++a)
        tuwasmit(a);

}

///IST GLEICHZUSETZEN MIT.....

{///...IN C (!!)   NAMESPACE BLA

    int a = 0;
    while(a != 10)
    {
        tuwasmit(a);
        ++a;
    }

}

{///...C++, (natürlich) abwärtskompatibel zu C 
 ///NAMESPACE BLA (jetzt)

    {//Alles noch in Klammern, noch ein Namensraum

        int a = 0;
        while(a != 10)
        {
            tuwasmit(a);
            ++a;
        }

    }///Schluss

}
</code></pre>
<p>Edit: Das ist nicht ganz richtig. Die dritte Angabe (z.b. ein Inkrement) wird ERST ausgeführt, wenn die Bedingung zutrifft. Also eigentlich</p>
<pre><code class="language-cpp">{
    int a = 0;
    while(a != 10)
    {
        tuwasmit(a);
        if(a != 10)
            ++a;
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2158474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2158474</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 18 Dec 2011 18:52:06 GMT</pubDate></item></channel></rss>