<?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[CreateFile - return Wert prüfen kompiliert nicht]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche das Ergebnis von CreateFile zu prüfen, aber mein Compiler (GCC 7.1) will nicht:</p>
<pre><code>constexpr bool file_is_valid(HANDLE h) noexcept
{ return h != INVALID_HANDLE_VALUE; }
</code></pre>
<blockquote>
<p>error: reinterpret_cast from integer to pointer<br />
{ return h != INVALID_HANDLE_VALUE; }</p>
</blockquote>
<p>INVALID_HANDLE_VALUE ist wohl definiert als (HANDLE)-1</p>
<p>Hat jemand eine Idee? Ich habe schon alles versucht was ich kann.</p>
<p>LG<br />
<strong>EDIT</strong> Ich bin mir nun ziemlich sicher es liegt daran, weil ich überall ein <code>constexpr</code> verwenden wollte. Die Lösung wäre also kein <code>constexpr</code> zu verwenden zusammen mit INVALID_HANDLE_VALUE.</p>
<blockquote>
<p>[...] your attempts are blocked by the rules in [expr.const]/2 which say that various expressions are not allowed in core constant expressions [...]</p>
</blockquote>
<p><a href="https://stackoverflow.com/questions/10369606/constexpr-pointer-value" rel="nofollow">https://stackoverflow.com/questions/10369606/constexpr-pointer-value</a></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/343326/createfile-return-wert-prüfen-kompiliert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 21:23:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/343326.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Jun 2017 18:45:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateFile - return Wert prüfen kompiliert nicht on Thu, 15 Jun 2017 19:48:13 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche das Ergebnis von CreateFile zu prüfen, aber mein Compiler (GCC 7.1) will nicht:</p>
<pre><code>constexpr bool file_is_valid(HANDLE h) noexcept
{ return h != INVALID_HANDLE_VALUE; }
</code></pre>
<blockquote>
<p>error: reinterpret_cast from integer to pointer<br />
{ return h != INVALID_HANDLE_VALUE; }</p>
</blockquote>
<p>INVALID_HANDLE_VALUE ist wohl definiert als (HANDLE)-1</p>
<p>Hat jemand eine Idee? Ich habe schon alles versucht was ich kann.</p>
<p>LG<br />
<strong>EDIT</strong> Ich bin mir nun ziemlich sicher es liegt daran, weil ich überall ein <code>constexpr</code> verwenden wollte. Die Lösung wäre also kein <code>constexpr</code> zu verwenden zusammen mit INVALID_HANDLE_VALUE.</p>
<blockquote>
<p>[...] your attempts are blocked by the rules in [expr.const]/2 which say that various expressions are not allowed in core constant expressions [...]</p>
</blockquote>
<p><a href="https://stackoverflow.com/questions/10369606/constexpr-pointer-value" rel="nofollow">https://stackoverflow.com/questions/10369606/constexpr-pointer-value</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2532686</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2532686</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Thu, 15 Jun 2017 19:48:13 GMT</pubDate></item><item><title><![CDATA[Reply to CreateFile - return Wert prüfen kompiliert nicht on Fri, 16 Jun 2017 12:13:48 GMT]]></title><description><![CDATA[<p>Ich bin mir nicht sicher, aber ein reinterpret_cast ist in einem constexpr nicht erlaubt.</p>
<p>Vermutlich ist es der C-Cast der hier einfach nicht erlaubt ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2532733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2532733</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 16 Jun 2017 12:13:48 GMT</pubDate></item></channel></rss>