<?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[Was ist das für ein Konstrukt return !!::gmatch( ?]]></title><description><![CDATA[<p>Hallo,</p>
<p>mir kommen in letzter Zeit immer mehr Konstrukte folgender Art<br />
vor die Augen:</p>
<p>return !!::gmatch(pattern, c_str());</p>
<p>Was ist der Hintergrund hierfür ?</p>
<p>Eine doppelte Verneinung ? Kann man sich doch eigentlich sparen.</p>
<p>Oder gibt es noch andere Gründe hierfür ?</p>
<p>Grüsse Joachim</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/191837/was-ist-das-für-ein-konstrukt-return-gmatch</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 23:46:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/191837.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Sep 2007 07:37:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Fri, 07 Sep 2007 07:37:39 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>mir kommen in letzter Zeit immer mehr Konstrukte folgender Art<br />
vor die Augen:</p>
<p>return !!::gmatch(pattern, c_str());</p>
<p>Was ist der Hintergrund hierfür ?</p>
<p>Eine doppelte Verneinung ? Kann man sich doch eigentlich sparen.</p>
<p>Oder gibt es noch andere Gründe hierfür ?</p>
<p>Grüsse Joachim</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360590</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360590</guid><dc:creator><![CDATA[need4]]></dc:creator><pubDate>Fri, 07 Sep 2007 07:37:39 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Fri, 07 Sep 2007 07:49:58 GMT]]></title><description><![CDATA[<p>need4 schrieb:</p>
<blockquote>
<p>Eine doppelte Verneinung ? Kann man sich doch eigentlich sparen.</p>
</blockquote>
<p>damit kannst du aus einen beliebigen zahlenwert eine 1 (wenn er ungleich 0 ist) oder eine 0 (wenn er gleich 0 ist) machen. das entspricht in etwa einem type-cast nach 'bool'.<br />
<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/1360601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360601</guid><dc:creator><![CDATA[Undertaker]]></dc:creator><pubDate>Fri, 07 Sep 2007 07:49:58 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Fri, 07 Sep 2007 09:03:14 GMT]]></title><description><![CDATA[<p>Mach ich auch immer, z.B. um aus einem 'BOOL' einen 'bool' zu machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360644</guid><dc:creator><![CDATA[jencas]]></dc:creator><pubDate>Fri, 07 Sep 2007 09:03:14 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Fri, 07 Sep 2007 15:40:35 GMT]]></title><description><![CDATA[<p>Jupp.<br />
MSVC z.B. meckert (performance warning) wenn man nen static_cast&lt;bool&gt;(x) macht. Bei !!x meckert MSVC NICHT, daher hab' ich mir das angewöhnt.<br />
Man kann allerdings auch x != 0 schreiben, was Noobs dann besser verstehen.</p>
<p>Der !! &quot;Trick&quot; ist auf jeden Fall alt und gut und sorgt immer wieder (zur Belustigung von Leuten die ihn schon kenne) für Verwirrung <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/1360908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360908</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 07 Sep 2007 15:40:35 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Fri, 07 Sep 2007 15:52:37 GMT]]></title><description><![CDATA[<blockquote>
<p>Bei !!x meckert MSVC NICHT, daher hab' ich mir das angewöhnt.</p>
</blockquote>
<p>Solche Sperenzchen hätte ich von dir nicht erwartet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360915</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360915</guid><dc:creator><![CDATA[CodeGrinder]]></dc:creator><pubDate>Fri, 07 Sep 2007 15:52:37 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 00:13:14 GMT]]></title><description><![CDATA[<p>CodeGrinder schrieb:</p>
<blockquote>
<blockquote>
<p>Bei !!x meckert MSVC NICHT, daher hab' ich mir das angewöhnt.</p>
</blockquote>
<p>Solche Sperenzchen hätte ich von dir nicht erwartet.</p>
</blockquote>
<p>Blubb. Blah. Blablah. Blablubber. Blabloink.<br />
Sonst noch welche Weisheiten zu verkünden die du der Welt nicht vorenthalten kannst?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361131</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361131</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sat, 08 Sep 2007 00:13:14 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 05:28:46 GMT]]></title><description><![CDATA[<p>warum benutzt du bewußt code von dem du weißt das er verwirrend ist? willst du deine nachfolger ärgern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361142</guid><dc:creator><![CDATA[blablu]]></dc:creator><pubDate>Sat, 08 Sep 2007 05:28:46 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 06:30:08 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Das hat er doch geschrieben. Lies es dir halt durch.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361145</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 08 Sep 2007 06:30:08 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 06:32:35 GMT]]></title><description><![CDATA[<p>Da steht nur, dass das &quot;alt und gut&quot; ist.</p>
<p>Wo ist der Vorteil gegenüber der Schreibweise x != 0?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361146</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 08 Sep 2007 06:32:35 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 06:54:12 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>MFK schrieb:</p>
<blockquote>
<p>Da steht nur, dass das &quot;alt und gut&quot; ist.<br />
Wo ist der Vorteil gegenüber der Schreibweise x != 0?</p>
</blockquote>
<p>Bin ich blöd?</p>
<p>hustbaer schrieb:</p>
<blockquote>
<p>MSVC z.B. meckert (performance warning) wenn man nen static_cast&lt;bool&gt;(x) macht. Bei !!x meckert MSVC NICHT, daher hab' ich mir das angewöhnt.</p>
</blockquote>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361149</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 08 Sep 2007 06:54:12 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 06:59:08 GMT]]></title><description><![CDATA[<p>chrische5 schrieb:</p>
<blockquote>
<p>Bin ich blöd?</p>
</blockquote>
<p>Ich fragte nicht nach dem Vorteil gegenüber dem Cast, sondern gegenüber x != 0.</p>
<p>hustbaer schrieb:</p>
<blockquote>
<p>Man kann allerdings auch x != 0 schreiben, was Noobs dann besser verstehen.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1361150</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361150</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 08 Sep 2007 06:59:08 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 07:14:53 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>MFK schrieb:</p>
<blockquote>
<p>chrische5 schrieb:</p>
<blockquote>
<p>Bin ich blöd?</p>
</blockquote>
<p>Ich fragte nicht nach dem Vorteil gegenüber dem Cast, sondern gegenüber x != 0.</p>
<p>hustbaer schrieb:</p>
<blockquote>
<p>Man kann allerdings auch x != 0 schreiben, was Noobs dann besser verstehen.</p>
</blockquote>
</blockquote>
<p>Dann bin ich tatsächlich blöd. <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>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361153</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361153</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 08 Sep 2007 07:14:53 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 07:19:19 GMT]]></title><description><![CDATA[<p>hustbaer schrieb:</p>
<blockquote>
<p>Jupp.<br />
MSVC z.B. meckert (performance warning) wenn man nen static_cast&lt;bool&gt;(x) macht. Bei !!x meckert MSVC NICHT, daher hab' ich mir das angewöhnt.</p>
</blockquote>
<p>gibt er auch so'ne fehlermeldung aus, wenn du einen C-style cast benutzt <em>(bool)x</em>?<br />
naja, ist möglicherweise nicht das selbe, weil ein <em>bool</em> in C++ ja eigentlich ein <em>char</em> ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361155</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361155</guid><dc:creator><![CDATA[Undertaker]]></dc:creator><pubDate>Sat, 08 Sep 2007 07:19:19 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 08:29:06 GMT]]></title><description><![CDATA[<p>Undertaker schrieb:</p>
<blockquote>
<p>naja, ist möglicherweise nicht das selbe, weil ein <em>bool</em> in C++ ja eigentlich ein <em>char</em> ist.</p>
</blockquote>
<p>Wer hat dir denn das erzählt? 'bool' ist ein eigenständiger Datentyp, der zwei mögliche Werte annehmen kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361165</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 08 Sep 2007 08:29:06 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 08:36:10 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>Undertaker schrieb:</p>
<blockquote>
<p>naja, ist möglicherweise nicht das selbe, weil ein <em>bool</em> in C++ ja eigentlich ein <em>char</em> ist.</p>
</blockquote>
<p>Wer hat dir denn das erzählt? 'bool' ist ein eigenständiger Datentyp, der zwei mögliche Werte annehmen kann.</p>
</blockquote>
<p>hab' mal gehört, dass bool kein bit sondern sizeof(char) gross ist.<br />
aber, ich hab's gerade ausprobiert: <em>(bool)13</em> ergibt <em>1</em>, ohne warnings des msvc.<br />
<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/1361166</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361166</guid><dc:creator><![CDATA[Undertaker]]></dc:creator><pubDate>Sat, 08 Sep 2007 08:36:10 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Sat, 08 Sep 2007 08:47:49 GMT]]></title><description><![CDATA[<p>Wie groß bool ist, wird afaik nicht festgelegt - aber 1 Byte ist das kleinste, was C++ direkt verarbeiten kann. (aber selbst wenn zwei Datentypen identische Größe haben, sagt das herzlich wenig über ihre Verwandschaftsverhältnisse aus - int ist häufig genauso groß wie long oder short, long double genauso groß wie double - und signed int und unsigned int haben per Definition die selbe Größe)</p>
<p>(btw, in einem vector&lt;bool&gt; wird tatsächlich nur 1 Bit pro Wert benötigt)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1361169</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1361169</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 08 Sep 2007 08:47:49 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist das für ein Konstrukt return !!::gmatch( ? on Mon, 10 Sep 2007 13:37:12 GMT]]></title><description><![CDATA[<p>Also Leute... ehrlich.<br />
Wer a = !!b; nicht versteht der soll heimgehen, den kann als C++ Programmierer keiner gebrauchen.<br />
Klar darf man dafür auch mal ein paar Minuten überlegen, bis man sich eben sicher ist dass es doch das und nichts anderes tut als das was man vermutet(nämlich 2x &quot;verneinen&quot;), aber davon geht die Welt nicht unter -- das macht man 1x und dann weiss man es.</p>
<p>Ansonsten: C-Style Casts schreibe ich aus Prinzip keine mehr, und das &quot;!= 0&quot; ist eben nicht gerade übersichtlich, weils hinten dran steht. Daher ist &quot;!!&quot; eigentlich übersichtlicher und besser, auch wenn man mal doof guckt wenn man es noch nicht kennt.<br />
Dasselbe trifft allerdings auf viele andere Dinge auch zu, Templates, Virtual Pure Funktionen, virtuelle Vererbung etc. - das alles ist erstmal (auch syntaktisch) etwas bis sehr verwirrent wenn man es noch nicht kennt. Was aber IMO kein Grund sein sollte es nicht zu verwenden.</p>
<p>Davon abgesehen war das ganze auch nicht so 100% ernst gemeint.</p>
<p>p.S.: wer jetzt auf die Idee kommt man könnte ja auch &quot;0 != ...&quot; schreiben, damit's eben vorne dransteht: das mach' ich auch aus Prinzip nicht -- kommt mir irgendwie &quot;verkehrt herum&quot; vor. Klar isses dem Compiler egal ob man &quot;variable != konstante&quot; oder &quot;konstante != variable&quot; schreibt, aber &quot;variable != konstante&quot; finde ich nunmal verständlicher, natürlicher, ... .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1362551</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1362551</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 10 Sep 2007 13:37:12 GMT</pubDate></item></channel></rss>