<?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[Abkürzung...]]></title><description><![CDATA[<p>Kann man das nicht so irgendwie schreiben?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int HoleWert()
{
	return 4;
}

int main()
{
	int a = 3;

	if(a != (a = HoleWert()))
		cout &lt;&lt; &quot;Jetzt aber&quot; &lt;&lt; endl;

	cout &lt;&lt; a;
}
</code></pre>
<p>Wenn a noch nicht 4 war, soll &quot;Jetzt aber&quot; ausgegeben werden. Anschließend soll a automatisch 4 sein, weil Zuweisung. Aber das linke a scheint auch 4 zu sein, also es wird nix ausgegeben...</p>
<p>Gibts ne Möglichkeit das irgendwie so kurz hinzuschreiben?</p>
<p>Ich möchte nämlich nicht das machen:</p>
<pre><code class="language-cpp">if(a != HoleWert())
	{
		cout &lt;&lt; &quot;Jetzt aber&quot; &lt;&lt; endl;
		a = HoleWert();
	}
</code></pre>
<p>Möchte die Funktion nur einmal aufrufen und auch nicht unnötig eine weitere Variable anlegen... <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>
]]></description><link>https://www.c-plusplus.net/forum/topic/226125/abkürzung</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 02:57:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/226125.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Oct 2008 19:54:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Abkürzung... on Wed, 29 Oct 2008 19:54:13 GMT]]></title><description><![CDATA[<p>Kann man das nicht so irgendwie schreiben?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

int HoleWert()
{
	return 4;
}

int main()
{
	int a = 3;

	if(a != (a = HoleWert()))
		cout &lt;&lt; &quot;Jetzt aber&quot; &lt;&lt; endl;

	cout &lt;&lt; a;
}
</code></pre>
<p>Wenn a noch nicht 4 war, soll &quot;Jetzt aber&quot; ausgegeben werden. Anschließend soll a automatisch 4 sein, weil Zuweisung. Aber das linke a scheint auch 4 zu sein, also es wird nix ausgegeben...</p>
<p>Gibts ne Möglichkeit das irgendwie so kurz hinzuschreiben?</p>
<p>Ich möchte nämlich nicht das machen:</p>
<pre><code class="language-cpp">if(a != HoleWert())
	{
		cout &lt;&lt; &quot;Jetzt aber&quot; &lt;&lt; endl;
		a = HoleWert();
	}
</code></pre>
<p>Möchte die Funktion nur einmal aufrufen und auch nicht unnötig eine weitere Variable anlegen... <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1606815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606815</guid><dc:creator><![CDATA[Psychot]]></dc:creator><pubDate>Wed, 29 Oct 2008 19:54:13 GMT</pubDate></item><item><title><![CDATA[Reply to Abkürzung... on Wed, 29 Oct 2008 20:40:59 GMT]]></title><description><![CDATA[<p>nö</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606825</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606825</guid><dc:creator><![CDATA[ich sag jetzt mal]]></dc:creator><pubDate>Wed, 29 Oct 2008 20:40:59 GMT</pubDate></item><item><title><![CDATA[Reply to Abkürzung... on Wed, 29 Oct 2008 20:43:52 GMT]]></title><description><![CDATA[<p>Wie wärs, wenn du die Abfrage einfach ganz weglassen würdest? Ist eine Zuweisung denn nicht gut genug?</p>
<p>Steckt da möglicherweise sogar Premature Optimization dahinter?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606826</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 29 Oct 2008 20:43:52 GMT</pubDate></item><item><title><![CDATA[Reply to Abkürzung... on Wed, 29 Oct 2008 21:02:12 GMT]]></title><description><![CDATA[<p>Ja ich weiß, unnötige Mikrooptimierung <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="🙄"
    /><br />
Ne, ich möchte ja drauf reagieren wenn a nicht mehr HoleWert() ist...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606831</guid><dc:creator><![CDATA[Psychot]]></dc:creator><pubDate>Wed, 29 Oct 2008 21:02:12 GMT</pubDate></item><item><title><![CDATA[Reply to Abkürzung... on Wed, 29 Oct 2008 21:08:46 GMT]]></title><description><![CDATA[<p>Das wird nicht einfacher gehen als in deinem letzten Codebeispiel. Beziehungsweise würde eine Verkürzung des Codes wahrscheinlich keine Verbesserung des Maschinencodes bewirken...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1606840</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1606840</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 29 Oct 2008 21:08:46 GMT</pubDate></item></channel></rss>