<?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 mit 2 argumenten: if(a,b)]]></title><description><![CDATA[<p>hallo allerseits,</p>
<p>ich verwende eine klassenmethode mit zwei argumenten, die einen boolschen wert zurueckgibt, also in etwa:</p>
<pre><code>class MyClass {
   ...
   virtual bool func(obj1&amp; a,obj2&amp; b=default);
}

bool MyClass::func(a,b) {...}
</code></pre>
<p>das zweite argument besitzt einen default-wert.</p>
<p>nun habe ich aus versehen folgende if-schleife konstruiert:</p>
<pre><code>MyClass myObject_;
if(myObject.func(a),b) {...}
</code></pre>
<p>statt</p>
<pre><code>if(myObject.func(a,b)) {...}
</code></pre>
<p>die klammer stand also an falscher stelle.</p>
<p>so weit so gut, hab den fehler ja gefunden, nur hat der compiler nicht gemeckert, das programm lief sogar!</p>
<p>deshalb nun meine frage: ist</p>
<pre><code>if(a,b) {...}
</code></pre>
<p>, also if mit zwei nicht durch logische operatoren wie &amp;&amp; oder || getrennten argumenten, in C++ erlaubt? anscheinend schon, aber was bedeutet es dann?</p>
<p>konnte nichts bei google, auf seiten wie <a href="http://cplusplus.com" rel="nofollow">cplusplus.com</a> oder in einschlaegigen buechern dazu finden.</p>
<p>vielen dank schon mal,<br />
snow.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/249098/if-mit-2-argumenten-if-a-b</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 16:29:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/249098.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Sep 2009 17:33:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to if mit 2 argumenten: if(a,b) on Wed, 02 Sep 2009 17:33:56 GMT]]></title><description><![CDATA[<p>hallo allerseits,</p>
<p>ich verwende eine klassenmethode mit zwei argumenten, die einen boolschen wert zurueckgibt, also in etwa:</p>
<pre><code>class MyClass {
   ...
   virtual bool func(obj1&amp; a,obj2&amp; b=default);
}

bool MyClass::func(a,b) {...}
</code></pre>
<p>das zweite argument besitzt einen default-wert.</p>
<p>nun habe ich aus versehen folgende if-schleife konstruiert:</p>
<pre><code>MyClass myObject_;
if(myObject.func(a),b) {...}
</code></pre>
<p>statt</p>
<pre><code>if(myObject.func(a,b)) {...}
</code></pre>
<p>die klammer stand also an falscher stelle.</p>
<p>so weit so gut, hab den fehler ja gefunden, nur hat der compiler nicht gemeckert, das programm lief sogar!</p>
<p>deshalb nun meine frage: ist</p>
<pre><code>if(a,b) {...}
</code></pre>
<p>, also if mit zwei nicht durch logische operatoren wie &amp;&amp; oder || getrennten argumenten, in C++ erlaubt? anscheinend schon, aber was bedeutet es dann?</p>
<p>konnte nichts bei google, auf seiten wie <a href="http://cplusplus.com" rel="nofollow">cplusplus.com</a> oder in einschlaegigen buechern dazu finden.</p>
<p>vielen dank schon mal,<br />
snow.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1771061</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1771061</guid><dc:creator><![CDATA[snow777]]></dc:creator><pubDate>Wed, 02 Sep 2009 17:33:56 GMT</pubDate></item><item><title><![CDATA[Reply to if mit 2 argumenten: if(a,b) on Wed, 02 Sep 2009 17:43:56 GMT]]></title><description><![CDATA[<p><a href="http://www.if-schleife.de" rel="nofollow">www.if-schleife.de</a><br />
<a href="http://en.wikipedia.org/wiki/Comma_operator" rel="nofollow">http://en.wikipedia.org/wiki/Comma_operator</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1771062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1771062</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 02 Sep 2009 17:43:56 GMT</pubDate></item><item><title><![CDATA[Reply to if mit 2 argumenten: if(a,b) on Wed, 02 Sep 2009 17:56:27 GMT]]></title><description><![CDATA[<p>volkard schrieb:</p>
<blockquote>
<p><a href="http://www.if-schleife.de" rel="nofollow">www.if-schleife.de</a></p>
</blockquote>
<p><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>
<p>volkard schrieb:</p>
<blockquote>
<p><a href="http://en.wikipedia.org/wiki/Comma_operator" rel="nofollow">http://en.wikipedia.org/wiki/Comma_operator</a></p>
</blockquote>
<p>vielen dank! hatte ich voellig vergessen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1771067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1771067</guid><dc:creator><![CDATA[snow777]]></dc:creator><pubDate>Wed, 02 Sep 2009 17:56:27 GMT</pubDate></item><item><title><![CDATA[Reply to if mit 2 argumenten: if(a,b) on Wed, 02 Sep 2009 18:09:05 GMT]]></title><description><![CDATA[<p>Also ich finde if(a,b) kommt der ominösen if-schleife schon sehr nahe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1771073</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1771073</guid><dc:creator><![CDATA[honig]]></dc:creator><pubDate>Wed, 02 Sep 2009 18:09:05 GMT</pubDate></item></channel></rss>