<?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[std::numeric_limits&amp;lt;double&amp;gt;::max() und max]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe mir einen kleine Header mit verschiedenen inline Funktionen geschrieben und dabei verwende ich auch folgende Konstante:</p>
<pre><code class="language-cpp">std::numeric_limits&lt;double&gt;::max()
</code></pre>
<p>Wenn ich mein Projekt nun kompiliere, bekomme ich immer Fehlermeldungen, also habe ich in die Headerdatei</p>
<pre><code class="language-cpp">undef max
</code></pre>
<p>geschrieben. Funktioniert auch, aber da ich für mein Projekt GDI+ benutze, kriege ich jetzt folgende Fehlermeldung (vor Einbindung dieser Dateien ging alles gut):</p>
<p>error C3861: 'max': identifier not found</p>
<p>Das ganze natürlich in einer zu GDI+ gehörenden Datei.</p>
<p>Was kann ich da machen?</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/184921/std-numeric_limits-lt-double-gt-max-und-max</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 00:10:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184921.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Jun 2007 11:39:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 11:39:47 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe mir einen kleine Header mit verschiedenen inline Funktionen geschrieben und dabei verwende ich auch folgende Konstante:</p>
<pre><code class="language-cpp">std::numeric_limits&lt;double&gt;::max()
</code></pre>
<p>Wenn ich mein Projekt nun kompiliere, bekomme ich immer Fehlermeldungen, also habe ich in die Headerdatei</p>
<pre><code class="language-cpp">undef max
</code></pre>
<p>geschrieben. Funktioniert auch, aber da ich für mein Projekt GDI+ benutze, kriege ich jetzt folgende Fehlermeldung (vor Einbindung dieser Dateien ging alles gut):</p>
<p>error C3861: 'max': identifier not found</p>
<p>Das ganze natürlich in einer zu GDI+ gehörenden Datei.</p>
<p>Was kann ich da machen?</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309821</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 20 Jun 2007 11:39:47 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 12:03:14 GMT]]></title><description><![CDATA[<p>du musst schauen, was sich hinter dem dem makro verbirgt, und das dann, sofern möglich als funktion umdefinieren.</p>
<p>gdi max ist wahrscheinlich nichts anderes als std::max, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309850</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309850</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Wed, 20 Jun 2007 12:03:14 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 13:21:50 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Genau. Die benutzen halt das normale Makro. Gibt es denn keine Möglichkeit, außer das als eigene Funktion zu bauen? Wenn es nur diese Möglichkeit gibt, muss ich das dann in den Header mit den selbstgeschriebenen Funktionen packen?</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309923</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 20 Jun 2007 13:21:50 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 13:24:24 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#define NOMINMAX

#include &lt;windows.h&gt;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1309926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309926</guid><dc:creator><![CDATA[NOMINMAX]]></dc:creator><pubDate>Wed, 20 Jun 2007 13:24:24 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 14:03:23 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich arbeite mit einer MFC SDI-Anwendung und weiß daher nicht, wo ich NOMINMAX definieren soll. Ich habe es im selber geschrieben Header und in der GDI+ Datei probiert, aber es hat beides nicht geklappt.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309953</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 20 Jun 2007 14:03:23 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 14:08:36 GMT]]></title><description><![CDATA[<p>Einfach vor der Windows.h oder am besten gaaaanz am Anfang in deiner StdAfx.h</p>
<p>Das ist übrigens der code den man damit rausnimmt:<br />
Ein typisches Beispiel für HOWnotTo use Makros</p>
<pre><code class="language-cpp">#ifndef NOMINMAX

#ifndef max
#define max(a,b)            (((a) &gt; (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) &lt; (b)) ? (a) : (b))
#endif

#endif  /* NOMINMAX */
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1309957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309957</guid><dc:creator><![CDATA[templäd]]></dc:creator><pubDate>Wed, 20 Jun 2007 14:08:36 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 14:23:02 GMT]]></title><description><![CDATA[<p>ohne templates war es früher viel schlimmer <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/1309973</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309973</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Wed, 20 Jun 2007 14:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 14:46:36 GMT]]></title><description><![CDATA[<p>Makros are evil! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309988</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Wed, 20 Jun 2007 14:46:36 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 15:23:35 GMT]]></title><description><![CDATA[<p>Artchi schrieb:</p>
<blockquote>
<p>Makros are evil! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
</blockquote>
<pre><code class="language-cpp">assert(&quot;Macros are evil!&quot;); // PENG!
</code></pre>
<p><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/1310017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310017</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Wed, 20 Jun 2007 15:23:35 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 17:50:56 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>War kurz weg. Entweder stelle ich mich zu blöd an, oder ich habe mein Problem nicht genau beschrieben. Ich habe nun auf Rat in stdafx.h folgendes geschrieben:</p>
<pre><code class="language-cpp">#define NOMINMAX
</code></pre>
<p>Nun bekomme ich hunderte Fehler alle a la:</p>
<blockquote>
<p>error C3861: 'max': identifier not found</p>
</blockquote>
<p>Alle aus den GDI+ Dateien. Das erscheint mir auch logisch, weil diese ja eben auf das Makro zugreifen, welches ich abgeschaltet habe. Das selbe hatte ich ja, als ich einfach</p>
<pre><code class="language-cpp">#undef max
</code></pre>
<p>geschrieben habe. Gibt es denn auch die Möglichkeit am Ende der Headerdatei das Makro wieder zu aktivieren? Warum beißt sich eigentlich:</p>
<pre><code class="language-cpp">std::numeric_limits&lt;double&gt;::max()
</code></pre>
<p>mit dem Makro max?</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310143</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 20 Jun 2007 17:50:56 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 18:09:27 GMT]]></title><description><![CDATA[<p>schreib doch max als funktion kurz selber damit es für gdi+ wieder zur verfügung steht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310149</guid><dc:creator><![CDATA[akary]]></dc:creator><pubDate>Wed, 20 Jun 2007 18:09:27 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 18:15:51 GMT]]></title><description><![CDATA[<p>Der Präprozessor ersetzt nunmal ohne Gnade alles was ihm in den Weg kommt. Er kennt max? Und ein max taucht in einem Text (Header oder CPP) auf? Wird ersetzt!</p>
<p>Versuch doch einfach mal std::numeric_limits&lt;double&gt;::max() zu kapseln (in einer Cpp) und hol es über eine andere Funktion.</p>
<pre><code class="language-cpp">// my_max.hpp
// in diesem Header natürlich KEINE gdiplus inkludieren!
extern double get_maXimum();

// my_max.cpp

// in dieser cpp natürlich KEINE gdiplus inkludieren!
double get_maXimum()
{
   return std::numeric_limits&lt;double&gt;::max();
}
</code></pre>
<p>Hoffentlich unterscheidet der Präprozessor ein kleines von einem großen X. Sonst wird auch das nichts bringen. <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/1310151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310151</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Wed, 20 Jun 2007 18:15:51 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 18:15:33 GMT]]></title><description><![CDATA[<p>chrische5 schrieb:</p>
<blockquote>
<blockquote>
<p>error C3861: 'max': identifier not found</p>
</blockquote>
<p>Alle aus den GDI+ Dateien. Das erscheint mir auch logisch, weil diese ja eben auf das Makro zugreifen, welches ich abgeschaltet habe.</p>
</blockquote>
<p>Bringe doch einfach vor der Inclusion des Problemheaders das std::max Template in den globalen Namensraum per using std::max (natürlich nachdem algorithm includiert wurde). Dann verwenden die Makro-Benutzer stattdessen das max-Template. NOMINMAX muss natürlich auch definiert sein, damit es nicht wieder Konflikte gibt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310152</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310152</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Wed, 20 Jun 2007 18:15:33 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 18:29:14 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe jetzt nach LordJaxom Tipp folgendes in stdafx.h geschrieben:</p>
<p>#include &lt;algorithm&gt;</p>
<p>using std::max;<br />
using std::min;</p>
<p>#define NOMINMAX</p>
<p>Und siehe da: es funktioniert.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310157</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 20 Jun 2007 18:29:14 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 18:33:17 GMT]]></title><description><![CDATA[<p>Warum bedankst du dich dann nicht bei LordJaxom?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310164</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310164</guid><dc:creator><![CDATA[templäd]]></dc:creator><pubDate>Wed, 20 Jun 2007 18:33:17 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Wed, 20 Jun 2007 18:40:17 GMT]]></title><description><![CDATA[<p>Artchi schrieb:</p>
<blockquote>
<p>Der Präprozessor ersetzt nunmal ohne Gnade alles was ihm in den Weg kommt. Er kennt max? Und ein max taucht in einem Text (Header oder CPP) auf? Wird ersetzt!</p>
<p>Versuch doch einfach mal std::numeric_limits&lt;double&gt;::max() zu kapseln (in einer Cpp) und hol es über eine andere Funktion.</p>
<pre><code class="language-cpp">// my_max.hpp
// in diesem Header natürlich KEINE gdiplus inkludieren!
extern double get_maXimum();

// my_max.cpp

// in dieser cpp natürlich KEINE gdiplus inkludieren!
double get_maXimum()
{
   return std::numeric_limits&lt;double&gt;::max();
}
</code></pre>
<p>Hoffentlich unterscheidet der Präprozessor ein kleines von einem großen X. Sonst wird auch das nichts bringen. <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>
</blockquote>
<p>ernst gemeint? so dumm ist der präprozesor auch nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310166</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310166</guid><dc:creator><![CDATA[queer_boy]]></dc:creator><pubDate>Wed, 20 Jun 2007 18:40:17 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Thu, 21 Jun 2007 06:21:53 GMT]]></title><description><![CDATA[<p>Eben. Erstens ersetzt der im preprocessing nur &quot;freistehende&quot; max, d.h. solche, die durch andere Tokens begrenzt sind. Und zweitens arbeitet der case sensitive.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310353</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Thu, 21 Jun 2007 06:21:53 GMT</pubDate></item><item><title><![CDATA[Reply to std::numeric_limits&amp;lt;double&amp;gt;::max() und max on Thu, 21 Jun 2007 07:51:49 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>templäd schrieb:</p>
<blockquote>
<p>Warum bedankst du dich dann nicht bei LordJaxom?</p>
</blockquote>
<p>Das war natülich als Dank gedacht.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310410</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Thu, 21 Jun 2007 07:51:49 GMT</pubDate></item></channel></rss>