<?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[Logfile ohne Overhead]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich moechte ein Logfile bzw. eine Logfileklasse erstellen.<br />
Allerdings soll mein Logfile nicht das gesamte Programm ausbremsen, aber gleichzeitig verschiedene Modi haben (Debug, Release, etc...), wobei halt mehr oder weniger viel (bis gar nichts) in das File geschrieben werden soll.</p>
<p>Ich habe gehoert, dass man die Aufrufe im Programm a la</p>
<pre><code class="language-cpp">if(modus == debug)
        print(...);
    else if(modus == release)
        //dont print anything
    else
        //kA
</code></pre>
<p>mittels Praeprozessormakros/funktionen beim compilieren schon wegoptimieren kann. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Weiss jemand wie das geht, bzw. wo man so etwas nachschauen kann? Und rentiert sich das ueberhaupt? (ich mein leserlicher wird es dadurch sicher nicht...)</p>
<p>Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/270428/logfile-ohne-overhead</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 00:13:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/270428.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Jul 2010 13:13:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 13:13:01 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich moechte ein Logfile bzw. eine Logfileklasse erstellen.<br />
Allerdings soll mein Logfile nicht das gesamte Programm ausbremsen, aber gleichzeitig verschiedene Modi haben (Debug, Release, etc...), wobei halt mehr oder weniger viel (bis gar nichts) in das File geschrieben werden soll.</p>
<p>Ich habe gehoert, dass man die Aufrufe im Programm a la</p>
<pre><code class="language-cpp">if(modus == debug)
        print(...);
    else if(modus == release)
        //dont print anything
    else
        //kA
</code></pre>
<p>mittels Praeprozessormakros/funktionen beim compilieren schon wegoptimieren kann. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Weiss jemand wie das geht, bzw. wo man so etwas nachschauen kann? Und rentiert sich das ueberhaupt? (ich mein leserlicher wird es dadurch sicher nicht...)</p>
<p>Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925029</guid><dc:creator><![CDATA[*lt**Exit*gt*]]></dc:creator><pubDate>Mon, 12 Jul 2010 13:13:01 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 13:16:49 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#ifdef DEBUG
// Logcode
#endif

Oder etwas ausgefallener:

#if DEBUGLEVEL &gt; 3
// Logcode der Priorität &gt; 3
#endif
</code></pre>
<p>Und ja, dies ist eine bewährte und oft benutzte Methode für das was du willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925032</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925032</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 12 Jul 2010 13:16:49 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 17:16:14 GMT]]></title><description><![CDATA[<p>hey, super Sache... Dankeschön! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925169</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925169</guid><dc:creator><![CDATA[*lt**Exit*gt*]]></dc:creator><pubDate>Mon, 12 Jul 2010 17:16:14 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 17:33:21 GMT]]></title><description><![CDATA[<p>Wieso eigentlich die Verwendung von Makros im Code?</p>
<p>Ich würde etwa sowas machen:</p>
<pre><code class="language-cpp">#ifdef DEBUG
const bool DEBUG_MODE  = 1;
#elsif
const bool DEBUG_MODE  = 0;
#endif
</code></pre>
<p>Sowas brauch man dann nur einmal und kann danach dann etwas<br />
verwenden wie:</p>
<pre><code class="language-cpp">if(DEBUG_MODE){
// log something
}
</code></pre>
<p>Dann hab ich innerhalb meines Codes wenigstens keine Macros...</p>
<p>Ein Compiler sollte doch in der Lage sein das Wegzuoptimieren, oder?</p>
<p>EDIT: Immerhin handelt es sich um einen Vergleich, in dem nur Konstanten sind <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925179</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 12 Jul 2010 17:33:21 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 17:52:49 GMT]]></title><description><![CDATA[<p>Auch nicht schlecht... Thx!</p>
<p>Aber wird da auch sowas wie &quot;debug &gt; 2&quot; wegoptimiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925188</guid><dc:creator><![CDATA[*lt**Exit*gt*]]></dc:creator><pubDate>Mon, 12 Jul 2010 17:52:49 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 17:56:00 GMT]]></title><description><![CDATA[<p>&lt;/Exit&gt; schrieb:</p>
<blockquote>
<p>Auch nicht schlecht... Thx!</p>
<p>Aber wird da auch sowas wie &quot;debug &gt; 2&quot; wegoptimiert?</p>
</blockquote>
<p>Vergleich von zwei Konstanten...</p>
<p>Mir würde kein Argument einfallen, warum ein Compiler das (zumindest im Release)<br />
nicht wegoptimieren könnte/wollte...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925192</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925192</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 12 Jul 2010 17:56:00 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 18:08:49 GMT]]></title><description><![CDATA[<p>Mal ein Indiz dafür, dass er es wegoptimiert:</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;

const int DEBUG = 1;

int main() {
        if(DEBUG == 1)
                std::cout &lt;&lt; &quot;DEBUG&quot; &lt;&lt; std::endl;
        else if(DEBUG == 2)
                std::cout &lt;&lt; &quot;NO DEBUG&quot; &lt;&lt; std::endl;
        int* debugPointer = const_cast&lt;int*&gt;(&amp;DEBUG);
        *debugPointer = 2;
        if(DEBUG == 1)
                std::cout &lt;&lt; &quot;DEBUG&quot; &lt;&lt; std::endl;
        else if(DEBUG==2)
                std::cout &lt;&lt; &quot;NO DEBUG&quot; &lt;&lt; std::endl;
        return 0;
}
</code></pre>
<blockquote>
<p>DEBUG<br />
Bus error</p>
</blockquote>
<p>Bei Verwendung von</p>
<pre><code class="language-cpp">int DEBUG = 1;
</code></pre>
<pre><code>DEBUG
NO DEBUG
</code></pre>
<p>Das stärkt (denke ich) meine Annahme, dass (zumindest) mein Compiler es (sogar im DEBUG) tut...</p>
<p>Wenn du es genau wissen möchtest, wirst du dir den Assembler-Code anschauen müssen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925198</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925198</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 12 Jul 2010 18:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 18:15:28 GMT]]></title><description><![CDATA[<p>Dead code elimination in solch offensichtlichen Fällen gehört zu den leichtesten Übungen eines C++-Compilers. Da muss man sich keine Sorgen machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925206</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925206</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Mon, 12 Jul 2010 18:15:28 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 18:18:09 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int* debugPointer = const_cast&lt;int*&gt;(&amp;DEBUG);
        *debugPointer = 2;
</code></pre>
<p>Ich kann auf die schnelle nicht sagen, ob das überhaupt funktioniert. Aber wenn es keinen Error vom Compiler gibt, dann darf er die If-Bedingung nicht wegoptimieren. Er muss erkennen, dass sich der Wert von DEBUG während der Laufzeit verändert.</p>
<p>Hat schon einer mal den Assembler-Code der Beispiele angesehen? Hier und nur hier erkennt man, wass optimiert wird und was nicht!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925209</guid><dc:creator><![CDATA[Siassei]]></dc:creator><pubDate>Mon, 12 Jul 2010 18:18:09 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 18:25:52 GMT]]></title><description><![CDATA[<p>Siassei schrieb:</p>
<blockquote>
<p>Aber wenn es keinen Error vom Compiler gibt, dann darf er die If-Bedingung nicht wegoptimieren. Er muss erkennen, dass sich der Wert von DEBUG während der Laufzeit verändert.</p>
</blockquote>
<p>Nein muss er nicht. Mit <code>const</code> gibt der Programmierer die Garantie, dass sich der Wert der Variable nicht ändert. Außerdem verhindert der Compiler direkte Zuweisungen. Irgendwelches Zuweisen über irgendwelche Hintertürchen erzeugt aber immer UD, also muss der Compiler gar nichts tun. <code>const_cast</code> ist eigentlich nur für Fälle gedacht, wenn z.B. in fremden Bibliotheken nicht auf Const-Correctness geachtet wurde, auch wenn z.B. in einer Funktion ein übergebener Zeiger nicht geändert wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925214</guid><dc:creator><![CDATA[ipsec]]></dc:creator><pubDate>Mon, 12 Jul 2010 18:25:52 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Mon, 12 Jul 2010 18:43:36 GMT]]></title><description><![CDATA[<p>Grundsatzfrage: Was spricht denn gegen die Verwendung von Makros in diesem Fall und für die Verwendung einer globalen Konstanten? Ich sehe da überhaupt keinen Vorteil. Eher im Gegenteil, weil man mit ifdef zur Not auch exotische Sachen machen könnte, mit einem einfachen if aber nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925225</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 12 Jul 2010 18:43:36 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Tue, 13 Jul 2010 00:35:56 GMT]]></title><description><![CDATA[<p>Vor allem muss man sich nicht um all die Compiler kümmern, die bei jedem konstanten Vergleich Warnungen ausgeben^^<br />
schon alleine das würde mich hier auch zum präprozessor greifen lassen</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925321</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Tue, 13 Jul 2010 00:35:56 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Tue, 13 Jul 2010 00:55:58 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Grundsatzfrage: Was spricht denn gegen die Verwendung von Makros in diesem Fall und für die Verwendung einer globalen Konstanten? Ich sehe da überhaupt keinen Vorteil. Eher im Gegenteil, weil man mit ifdef zur Not auch exotische Sachen machen könnte, mit einem einfachen if aber nicht.</p>
</blockquote>
<p>Schon klar, dass der Einsatzbereich von Konstanten begrenzt(er) ist.<br />
Allerdings mag ich persönlich absolut keine Makros in meinem Code...<br />
Deswegen bevorzuge ich so eine Definition in irgendeinem Header, den ich nie<br />
wieder anpacke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<p>unskilled schrieb:</p>
<blockquote>
<p>Vor allem muss man sich nicht um all die Compiler kümmern, die bei jedem konstanten Vergleich Warnungen ausgeben^^</p>
</blockquote>
<p>Warnungen sind/wären ein gutes Argument gegen deren Verwendung.<br />
Da du ja von 'all die Compiler' redest, vermute ich mal, dass der gcc<br />
es nicht macht.</p>
<p>Oder habe ich ein (entscheidendes) Flag vergessen?</p>
<pre><code>g++ main.cpp -pedantic -Wall -Wextra -Wstrict-overflow=5 -o test
</code></pre>
<p>Für meinen Privatgebrauch reicht mir eigentlich der GCC und für<br />
Microshizzle werde ich mir es nicht angewöhnen <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/1925322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925322</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Tue, 13 Jul 2010 00:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Tue, 13 Jul 2010 06:38:06 GMT]]></title><description><![CDATA[<p>wow, danke für die vielen sehr interessanten Beiträge... Ich glaub ich schau mir erstmal meinen Compiler an und werd dann sehen was geht und was nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Thx!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1925349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1925349</guid><dc:creator><![CDATA[*lt**Exit*gt*]]></dc:creator><pubDate>Tue, 13 Jul 2010 06:38:06 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 18:23:28 GMT]]></title><description><![CDATA[<p>Mal noch eine Frage:<br />
Macht es mehr Sinn, das Logfile einmal zu öffnen und erst wieder bei Programmende zu schließen oder bei jedem Zugriff zu öffnen/schließen?</p>
<p>Das Ganze soll ja auch bei Programmausfällen funktionieren, ist das problematisch, wenn evtl. das close entfällt (wenn man nur einmal öffnet und das Programm vor dem Schließen crasht)?<br />
Performance-technisch wäre ja einmal öffnen schneller...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926321</guid><dc:creator><![CDATA[*lt**Exit*gt*]]></dc:creator><pubDate>Wed, 14 Jul 2010 18:23:28 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 18:30:14 GMT]]></title><description><![CDATA[<p>Grundsätzlich sollte einmal öffnen vollkommen ausreichen. Bei einem Absturz <strong>sollte</strong> das Betriebssystem zusehen, dass die Resourcen wieder freigegeben werden. Letztendlich kann man das mit Exception aber in den meisten Fällen dank der Destruktoren sogar selber erledigen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926327</guid><dc:creator><![CDATA[lllllllllllll]]></dc:creator><pubDate>Wed, 14 Jul 2010 18:30:14 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 20:13:10 GMT]]></title><description><![CDATA[<p>CSpille schrieb:</p>
<blockquote>
<p>Wieso eigentlich die Verwendung von Makros im Code?</p>
<p>Ich würde etwa sowas machen:</p>
<pre><code class="language-cpp">#ifdef DEBUG
const bool DEBUG_MODE  = 1;
#elsif
const bool DEBUG_MODE  = 0;
#endif
</code></pre>
</blockquote>
<p>Du solltest aber niemals nicht auf gar keinen Fall eine Konstante in GROSSBUCHSTABEN schreiben, da dies per Konvention den Makros vorbehalten ist. Gerade mit deinem zweiten Beispiel</p>
<pre><code>const int DEBUG = 1;
</code></pre>
<p>könntest du Probleme bekommen.</p>
<p>Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926350</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926350</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 14 Jul 2010 20:13:10 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 20:14:15 GMT]]></title><description><![CDATA[<p>DOCH AUF JEDEN FALL GROSS SCHREIBEN. DER CODE GEHÖRT EH IN EINEN NAMESPACE:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926351</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926351</guid><dc:creator><![CDATA[_]]></dc:creator><pubDate>Wed, 14 Jul 2010 20:14:15 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 20:22:16 GMT]]></title><description><![CDATA[<p>_ schrieb:</p>
<blockquote>
<p>DOCH AUF JEDEN FALL GROSS SCHREIBEN. DER CODE GEHÖRT EH IN EINEN NAMESPACE:</p>
</blockquote>
<p>Soso, und das ändert was an dem Problem?</p>
<p>Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926357</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926357</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 14 Jul 2010 20:22:16 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 21:45:29 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Du solltest aber niemals nicht auf gar keinen Fall eine Konstante in GROSSBUCHSTABEN schreiben, da dies per Konvention den Makros vorbehalten ist. Gerade mit deinem zweiten Beispiel</p>
<pre><code>const int DEBUG = 1;
</code></pre>
<p>könntest du Probleme bekommen.</p>
</blockquote>
<p>Danke für den Hinweis, jedoch bin ich jetzt etwas überrascht, denn wenn ich<br />
mir so (Vorschläge für) Coding-Conventions ankucke, dann sieht man das<br />
häufiger:<br />
<a href="http://geosoft.no/development/cppstyle.html" rel="nofollow">http://geosoft.no/development/cppstyle.html</a></p>
<p>Das ist nur ein Beispiel.</p>
<p>Generell dachte ich, dass der Compiler seine MACROS mit '_'<br />
anfängt.</p>
<p>Deswegen habe ich bisher nur darauf geachtet, dass ich sowas nicht mache.<br />
Ausnahme sind include guards.</p>
<p>Die haben bei mir folgende Form:</p>
<pre><code class="language-cpp">#ifndef _MY_CLASS_H_
#define _MY_CLASS_H_
#endif
</code></pre>
<p>Warum eigentlich? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<p>Im gerade eingefügten Link beginnen (und enden) sie nicht mit '_' <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/1926374</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926374</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 14 Jul 2010 21:45:29 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 21:53:20 GMT]]></title><description><![CDATA[<p>CSpille schrieb:</p>
<blockquote>
<p>Ausnahme sind include guards.<br />
#ifndef _MY_CLASS_H_</p>
</blockquote>
<p>Ja, weil Du oder dein Buchautor in den vom Compilerbauer mitgelieferten Includefiles mal gestöbert haben und die machen es so. Also macht man es selber nach. Ganz falscher Fehler das.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926378</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926378</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 14 Jul 2010 21:53:20 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 21:55:47 GMT]]></title><description><![CDATA[<p>volkard schrieb:</p>
<blockquote>
<p>CSpille schrieb:</p>
<blockquote>
<p>Ausnahme sind include guards.<br />
#ifndef _MY_CLASS_H_</p>
</blockquote>
<p>Ja, weil Du oder dein Buchautor in den vom Compilerbauer mitgelieferten Includefiles mal gestöbert haben und die machen es so. Also macht man es selber nach. Ganz falscher Fehler das.</p>
</blockquote>
<p>Genau das, was ich befürchtet habe...<br />
Deine include guards heißen;</p>
<pre><code class="language-cpp">#ifndef MY_CLASS_H
</code></pre>
<p>?</p>
<p>Bestehen Konstanten bei dir aus Großbuchstaben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926379</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926379</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 14 Jul 2010 21:55:47 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 22:10:44 GMT]]></title><description><![CDATA[<p>CSpille schrieb:</p>
<blockquote>
<p>Bestehen Konstanten bei dir aus Großbuchstaben?</p>
</blockquote>
<p>Wenn sie sich anfühlen wie Makros, also mal PI oder so, dann meistens ja.<br />
Aber immer mehr Konstanten wandern mit static const in Klassen rein und da schreibe ich sie wie normale Variablen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926384</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Wed, 14 Jul 2010 22:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 22:18:03 GMT]]></title><description><![CDATA[<p>CSpille schrieb:</p>
<blockquote>
<p>Generell dachte ich, dass der Compiler seine MACROS mit '_'<br />
anfängt.</p>
</blockquote>
<p>Das Problem sind ja nicht nur die Makros, die vom Compiler kommen. Jeder kann in einem Header etwas definieren. Gerade DEBUG wird fast immer auf der Kommandozeile benutzt, wenn im Debugmodus übersetzt wird. Release wird dann häufig mit NDEBUG übersetzt (das assert verlangt das seit eh und je so).</p>
<p>In Qt3 wird z.B. &quot;signals&quot; (entgegen der Konvention in Kleinbuchstaben) definiert. Jeder, der schon mal boost signals benutzt hat, wünscht den Trollen vermutlich die Pest an den Hals <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Auch Adobe und Apple bekleckern sich da nicht gerade mit Ruhm.</p>
<p>Würden sich alle an die Konvention halten, gäbe es viel seltener Probleme.</p>
<p>Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926387</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 14 Jul 2010 22:18:03 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 22:25:13 GMT]]></title><description><![CDATA[<p>volkard schrieb:</p>
<blockquote>
<p>Wenn sie sich anfühlen wie Makros, also mal PI oder so, dann meistens ja.</p>
</blockquote>
<p>M_PI ist in math.h bzw cmath definiert, PI brauch man also nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1926388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926388</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 14 Jul 2010 22:25:13 GMT</pubDate></item><item><title><![CDATA[Reply to Logfile ohne Overhead on Wed, 14 Jul 2010 23:13:36 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Gerade DEBUG wird fast immer auf der Kommandozeile benutzt, wenn im Debugmodus übersetzt wird. Release wird dann häufig mit NDEBUG übersetzt (das assert verlangt das seit eh und je so).</p>
</blockquote>
<p>Okay... DEBUG war vielleicht kein sooo gutes Beispiel <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>
<p>Du denkst dabei an Folgendes, oder?</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;

const int DEBUG = 1;

int main() {
        if(DEBUG)
                std::cout &lt;&lt; &quot;DEBUG&quot; &lt;&lt; std::endl;
        return 0;
}
</code></pre>
<pre><code>g++ main.cpp -DDEBUG -o test
</code></pre>
<p>wobei DEBUG von manchen Compilern automatisch definiert wird.</p>
<pre><code>main.cpp:3: error: expected unqualified-id before numeric constant
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1926393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1926393</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 14 Jul 2010 23:13:36 GMT</pubDate></item></channel></rss>