<?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[Kurze Frage zu std::string]]></title><description><![CDATA[<p>Hallo,</p>
<p>bisher war mir das nicht so bewusst. Ist std::string in der Größe Wirklich fix?<br />
Folgender Code wirft mir einen Fehler.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main (int argc, char * const argv[]) {
    // insert code here...
    std::cout &lt;&lt; &quot;Hello, World!&quot; &lt;&lt; std::endl;
	std::string a(&quot;&quot;);
	std::cin &gt;&gt; a;

    return 0;
}
</code></pre>
<p>ändere ich es jedoch ab auf</p>
<pre><code class="language-cpp">std::string a(&quot;  &quot;);
</code></pre>
<p>kann ich beim cin 2 Zeichen eingeben. Bei &gt;3 Zeichen gleicher Fehler.</p>
<p>IDE ist übrigens XCode.<br />
Fehler:<br />
Untitled(3574) malloc: *** error for object 0x1000041c0: pointer being freed was not allocated<br />
*** set a breakpoint in malloc_error_break to debug<br />
Program received signal: “SIGABRT”</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/261000/kurze-frage-zu-std-string</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 21:34:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/261000.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Feb 2010 20:54:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 20:54:15 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>bisher war mir das nicht so bewusst. Ist std::string in der Größe Wirklich fix?<br />
Folgender Code wirft mir einen Fehler.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main (int argc, char * const argv[]) {
    // insert code here...
    std::cout &lt;&lt; &quot;Hello, World!&quot; &lt;&lt; std::endl;
	std::string a(&quot;&quot;);
	std::cin &gt;&gt; a;

    return 0;
}
</code></pre>
<p>ändere ich es jedoch ab auf</p>
<pre><code class="language-cpp">std::string a(&quot;  &quot;);
</code></pre>
<p>kann ich beim cin 2 Zeichen eingeben. Bei &gt;3 Zeichen gleicher Fehler.</p>
<p>IDE ist übrigens XCode.<br />
Fehler:<br />
Untitled(3574) malloc: *** error for object 0x1000041c0: pointer being freed was not allocated<br />
*** set a breakpoint in malloc_error_break to debug<br />
Program received signal: “SIGABRT”</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854402</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854402</guid><dc:creator><![CDATA[sirchillalot]]></dc:creator><pubDate>Thu, 11 Feb 2010 20:54:15 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 21:09:22 GMT]]></title><description><![CDATA[<p>Ich weiß nicht was dein Problem ist.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
    std::cout &lt;&lt; &quot;Hello, World!&quot; &lt;&lt; std::endl;
    std::string a(&quot;&quot;);
    std::cin &gt;&gt; a; //egal was ich eingebe
    std::cout &lt;&lt; a; //hier wird es optimal ausgegeben
}
</code></pre>
<p>Warum die Fehlermeldung kommt, verstehe ich auch nicht. Das Programm lässt sich mit CodeBlocks fehlerfrei ausführen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854408</guid><dc:creator><![CDATA[freaky]]></dc:creator><pubDate>Thu, 11 Feb 2010 21:09:22 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 21:16:40 GMT]]></title><description><![CDATA[<p>FreakY&lt;3Cpp schrieb:</p>
<blockquote>
<p>Ich weiß nicht was dein Problem ist.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
    std::cout &lt;&lt; &quot;Hello, World!&quot; &lt;&lt; std::endl;
    std::string a(&quot;&quot;);
    std::cin &gt;&gt; a; //egal was ich eingebe
    std::cout &lt;&lt; a; //hier wird es optimal ausgegeben
}
</code></pre>
<p>Warum die Fehlermeldung kommt, verstehe ich auch nicht. Das Programm lässt sich mit CodeBlocks fehlerfrei ausführen.</p>
</blockquote>
<p>XCode hällt sich hier wohl nicht an den Standard. Bzw. vlt ja auch gcc nicht. Weiß jetzt nicht wie es genau im Standard definiert ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854410</guid><dc:creator><![CDATA[sirchillalot]]></dc:creator><pubDate>Thu, 11 Feb 2010 21:16:40 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 21:28:06 GMT]]></title><description><![CDATA[<p>Die IDE hat herzlich wenig mit mit dem Programmverhalten zu tun, das liegt immer am Compiler bzw der std::string-Implementierung. Code::Blocks wird i.d.R. auch mit gcc benutzt und der Codeschnippsel funktioniert da auch.<br />
Benutzt du vielleicht eine Uralt-Version vom gcc?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854416</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Thu, 11 Feb 2010 21:28:06 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 21:31:44 GMT]]></title><description><![CDATA[<p>Ich hab keine Ahnung welchen gcc XCode nutzt ;). Weiß nicht mal ob es GCC ist. Glaube aber schon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854418</guid><dc:creator><![CDATA[sirchillalot]]></dc:creator><pubDate>Thu, 11 Feb 2010 21:31:44 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 21:35:52 GMT]]></title><description><![CDATA[<p>Na, dann gib mal gcc -v ein... und bei der Gelegenheit kannst du gleich versuchen, den Code direkt mit dem gcc ohne IDE zu kompilieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854420</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854420</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Thu, 11 Feb 2010 21:35:52 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Thu, 11 Feb 2010 21:39:13 GMT]]></title><description><![CDATA[<p>gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)</p>
<p>in der Konsole gehts <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="🙂"
    /> Also wohl doch ein anderer Kompiler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854421</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854421</guid><dc:creator><![CDATA[sirchillalot]]></dc:creator><pubDate>Thu, 11 Feb 2010 21:39:13 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Fri, 12 Feb 2010 06:47:39 GMT]]></title><description><![CDATA[<p>Wenn ich mich recht erinnere ist der Apple-GCC ziemlich kaputtgepatcht. Darüber hat sich der Maintainer von Portage-Prefix (also Gentoos Paketmanager auf quasi beliebigen unixoiden Betriebsystemen, unter anderem und vor allem OS <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f635.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--dizzy_face"
      title="X)"
      alt="😵"
    /> mehrmals mokiert.</p>
<p>Schau vielleicht mal, ob in XCode auch GCC 4 eingestellt ist, IIRC ist die Standardeinstellung bei XCode 2 nämlich GCC 3.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854488</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854488</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Fri, 12 Feb 2010 06:47:39 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Fri, 12 Feb 2010 07:14:40 GMT]]></title><description><![CDATA[<p>.filmor schrieb:</p>
<blockquote>
<p>Wenn ich mich recht erinnere ist der Apple-GCC ziemlich kaputtgepatcht. Darüber hat sich der Maintainer von Portage-Prefix (also Gentoos Paketmanager auf quasi beliebigen unixoiden Betriebsystemen, unter anderem und vor allem OS <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f635.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--dizzy_face"
      title="X)"
      alt="😵"
    /> mehrmals mokiert.</p>
<p>Schau vielleicht mal, ob in XCode auch GCC 4 eingestellt ist, IIRC ist die Standardeinstellung bei XCode 2 nämlich GCC 3.</p>
</blockquote>
<p>Jo scheint wohl ein Bug in Xcode zu sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854494</guid><dc:creator><![CDATA[sirchillalot]]></dc:creator><pubDate>Fri, 12 Feb 2010 07:14:40 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zu std::string on Fri, 12 Feb 2010 08:47:49 GMT]]></title><description><![CDATA[<p>sirchillalot schrieb:</p>
<blockquote>
<p>Jo scheint wohl ein Bug in Xcode zu sein.</p>
</blockquote>
<p>Wieso &quot;Bug in Xcode&quot; ??? Du weißt schon, dass Xcode kein Compiler ist, ja?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1854526</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1854526</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Fri, 12 Feb 2010 08:47:49 GMT</pubDate></item></channel></rss>