<?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[&amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum?]]></title><description><![CDATA[<p>Ich will die OpenGL-Routine <strong>glMultiDrawElements</strong> aufrufen, die folgende Signatur hat:</p>
<pre><code class="language-cpp">void glMultiDrawElements(GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei)
</code></pre>
<p>Als 4. Parameter verwende ich dabei eine Variable vom Typ <em><strong>GLuint</strong></em>**, was zu folgendem Kompilierfehler führt:</p>
<blockquote>
<p>Fehler: ungültige Umwandlung von »GLuint**« in »const GLvoid**«<br />
Fehler: Argument 4 von »void glMultiDrawElements(GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei)« wird initialisiert</p>
</blockquote>
<p>Wandle ich die Variable per reinterpret_cast in den Typ <em><strong>GLvoid</strong></em>**, so kommt immer noch die Meldung:</p>
<blockquote>
<p>Fehler: ungültige Umwandlung von »GLvoid**« in »const GLvoid**«<br />
Fehler: Argument 4 von »void glMultiDrawElements(GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei)« wird initialisiert</p>
</blockquote>
<p>Erst wenn ich darum noch einen const_cast setze, lässt es sich kompilieren.</p>
<p>Warum ist das so? Ich dachte bisher, ein const_casts wird gebraucht, wenn man die Konstantheit wegkriegen will; eine Variable als konstanten Parameter einer Funktion zu übergeben geht doch normalerweise aber implizit?</p>
<p>Ich verwende GCC 4.3.0 und hoffe, jemand erleuchtet mich bei dieser Frage!<br />
Danke schon mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/220052/quot-ungültige-umwandlung-von-glvoid-in-const-glvoid-quot-warum</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 14:02:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/220052.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Aug 2008 12:59:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 12:59:54 GMT]]></title><description><![CDATA[<p>Ich will die OpenGL-Routine <strong>glMultiDrawElements</strong> aufrufen, die folgende Signatur hat:</p>
<pre><code class="language-cpp">void glMultiDrawElements(GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei)
</code></pre>
<p>Als 4. Parameter verwende ich dabei eine Variable vom Typ <em><strong>GLuint</strong></em>**, was zu folgendem Kompilierfehler führt:</p>
<blockquote>
<p>Fehler: ungültige Umwandlung von »GLuint**« in »const GLvoid**«<br />
Fehler: Argument 4 von »void glMultiDrawElements(GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei)« wird initialisiert</p>
</blockquote>
<p>Wandle ich die Variable per reinterpret_cast in den Typ <em><strong>GLvoid</strong></em>**, so kommt immer noch die Meldung:</p>
<blockquote>
<p>Fehler: ungültige Umwandlung von »GLvoid**« in »const GLvoid**«<br />
Fehler: Argument 4 von »void glMultiDrawElements(GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei)« wird initialisiert</p>
</blockquote>
<p>Erst wenn ich darum noch einen const_cast setze, lässt es sich kompilieren.</p>
<p>Warum ist das so? Ich dachte bisher, ein const_casts wird gebraucht, wenn man die Konstantheit wegkriegen will; eine Variable als konstanten Parameter einer Funktion zu übergeben geht doch normalerweise aber implizit?</p>
<p>Ich verwende GCC 4.3.0 und hoffe, jemand erleuchtet mich bei dieser Frage!<br />
Danke schon mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1562682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562682</guid><dc:creator><![CDATA[Chewie83]]></dc:creator><pubDate>Mon, 11 Aug 2008 12:59:54 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 13:18:24 GMT]]></title><description><![CDATA[<blockquote>
<p>A single const_cast expression may add or remove any number of const or volatile modifiers.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1562699</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562699</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Mon, 11 Aug 2008 13:18:24 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 13:31:27 GMT]]></title><description><![CDATA[<p>Äh danke, aber das ist keine Antwort auf meine Frage. Ich hab ja bereits geschrieben, dass es mit dem const_cast vom Compiler angenommen wird, und dass man die Konstantheit dazucasten <strong>kann</strong>, ist ja auch klar. Aber ich will ja wissen, warum ich es <strong>muss</strong>, normalerweise passiert das ja implizit!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1562714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562714</guid><dc:creator><![CDATA[Chewie83]]></dc:creator><pubDate>Mon, 11 Aug 2008 13:31:27 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 16:31:15 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ein GLVoid** könnte implizit in einen GLVoid** const umgewandelt werden, nicht aber in einen GLVoid const **.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1562728</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562728</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Mon, 11 Aug 2008 16:31:15 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 16:15:58 GMT]]></title><description><![CDATA[<p>Danke,</p>
<p>hast Du auch eine Erklärung (gerne auch verlinkt), warum das so ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1562784</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562784</guid><dc:creator><![CDATA[Chewie83]]></dc:creator><pubDate>Mon, 11 Aug 2008 16:15:58 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 16:30:49 GMT]]></title><description><![CDATA[<p>C++ Standard, 4.4 (Qualification conversions), Punkt 4.</p>
<p>Folgendes Beispiel aus dem Standard:</p>
<blockquote>
<p>if a program could assign a pointer of type T** to a pointer of type const T** (that is, if line //1 below was allowed), a program could inadvertently modify a const object (as it is done for line //2). For example,</p>
<pre><code class="language-cpp">int main() {
  const char c = 'c';
  char* pc;
  const char** pcc = &amp;pc; //1: not allowed
  *pcc = &amp;c;
  *pc = 'C'; //2: modifies a const object
}
</code></pre>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1562792</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562792</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Mon, 11 Aug 2008 16:30:49 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;quot;Ungültige Umwandlung von »GLvoid**« in »const GLvoid**«&amp;quot;. Warum? on Mon, 11 Aug 2008 16:41:50 GMT]]></title><description><![CDATA[<p>Stimmt, das leuchtet ein, dankeschön!</p>
<p>Die Frage ist beantwortet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1562796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562796</guid><dc:creator><![CDATA[Chewie83]]></dc:creator><pubDate>Mon, 11 Aug 2008 16:41:50 GMT</pubDate></item></channel></rss>