<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Segmentation fault while c++ string concatenation... in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944930#M97637</link>
    <description>Try to modify method name as is&lt;BR /&gt;&lt;BR /&gt;string getfullname()&lt;BR /&gt;{ return (name + surname); }&lt;BR /&gt;</description>
    <pubDate>Fri, 16 Feb 2007 06:00:05 GMT</pubDate>
    <dc:creator>leonardo_20</dc:creator>
    <dc:date>2007-02-16T06:00:05Z</dc:date>
    <item>
      <title>Segmentation fault while c++ string concatenation...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944929#M97636</link>
      <description>I have a very small program to simulate my actual issue in a large program.&lt;BR /&gt;&lt;BR /&gt;I build it on one HPUX box and test it on another, it gives me core dump whenever I do string operation or even cout gives me core dump.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I built and linked that using gcc 3.4.2&lt;BR /&gt;&lt;BR /&gt;as&lt;BR /&gt;&lt;BR /&gt;g++ -v  -g -pthread -c test.cpp&lt;BR /&gt;&lt;BR /&gt; g++ -v -o TestStaticString test.o  -pthread -L /var/home/HPUXAGENT/lib -L/usr/local/lib  -lpthread -lcrypt -lxnet -lnsl -lsec -lstdc++ -Xlinker +b -Xlinker ../lib:. -Xlinker +s -z&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have two HPUX machine;&lt;BR /&gt; Box1 : build machine&lt;BR /&gt;$ uname -a&lt;BR /&gt;HP-UX unknown B.11.11 U 9000/800 1925780423 unlimited-user license&lt;BR /&gt;&lt;BR /&gt;Box2: Test machine&lt;BR /&gt;bash-2.04# uname -a&lt;BR /&gt;HP-UX kelp B.11.11 U 9000/785 2001873660 unlimited-user license&lt;BR /&gt;&lt;BR /&gt;Attached file contains -&lt;BR /&gt;    Sample Program&lt;BR /&gt;    Sample program output&lt;BR /&gt;    Core file analysis&lt;BR /&gt;    program debugging with gdb&lt;BR /&gt;    swlist on build machine&lt;BR /&gt;    swlist on test machine&lt;BR /&gt;    Building and linking&lt;BR /&gt;    Build machine&lt;BR /&gt;    Test machine&lt;BR /&gt;  &lt;BR /&gt;I have posted this on general forum and got much help , but I am posting this again here , beacause its more related to c++ language.&lt;BR /&gt;&lt;BR /&gt;One last point , the same sample program works fine on a third HPUX box. The detail are given in the attached file&lt;BR /&gt;&lt;BR /&gt;Any help regarding this is much appreciated.&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Thu, 15 Feb 2007 00:11:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944929#M97636</guid>
      <dc:creator>Sanjay Sutar</dc:creator>
      <dc:date>2007-02-15T00:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault while c++ string concatenation...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944930#M97637</link>
      <description>Try to modify method name as is&lt;BR /&gt;&lt;BR /&gt;string getfullname()&lt;BR /&gt;{ return (name + surname); }&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Feb 2007 06:00:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944930#M97637</guid>
      <dc:creator>leonardo_20</dc:creator>
      <dc:date>2007-02-16T06:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault while c++ string concatenation...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944931#M97638</link>
      <description>Also... I suggest you to use this declaration:&lt;BR /&gt;&lt;BR /&gt;static1 s = new static1();&lt;BR /&gt;&lt;BR /&gt;and call the methods as is&lt;BR /&gt;&lt;BR /&gt;string fname = s.getfullname();&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Leonardo</description>
      <pubDate>Fri, 16 Feb 2007 06:08:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944931#M97638</guid>
      <dc:creator>leonardo_20</dc:creator>
      <dc:date>2007-02-16T06:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Segmentation fault while C++ string concatenation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944932#M97639</link>
      <description>&lt;P&gt;&amp;gt;Leonardo: Try to modify method name as is: { return (name + surname); }&lt;BR /&gt;&lt;BR /&gt;Adding () won't help. The problem is that static1::name isn't initialized.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I suggest you to use this declaration:&lt;BR /&gt;&amp;gt;static1 s = new static1();&lt;BR /&gt;&amp;gt;and call the methods as is&lt;BR /&gt;&amp;gt;string fname = s.getfullname();&lt;BR /&gt;&lt;BR /&gt;s needs to be a reference or object for ".".&lt;BR /&gt;&lt;BR /&gt;Also, this doesn't solve the problem with "name".&lt;/P&gt;</description>
      <pubDate>Sun, 16 Oct 2011 10:53:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/segmentation-fault-while-c-string-concatenation/m-p/3944932#M97639</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-10-16T10:53:10Z</dc:date>
    </item>
  </channel>
</rss>

