<?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: Treatment of Stack Space used for Function Calls in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598295#M679707</link>
    <description>stack space reduction is a chanllenge and devellopers work hard to reduce number of elements pushed onto a program's stack space during program execution... there are tools/commpilers  to help with code optimization. &lt;BR /&gt;t#&lt;BR /&gt;</description>
    <pubDate>Sat, 13 Mar 2010 14:01:08 GMT</pubDate>
    <dc:creator>T. M. Louah</dc:creator>
    <dc:date>2010-03-13T14:01:08Z</dc:date>
    <item>
      <title>Treatment of Stack Space used for Function Calls</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598291#M679703</link>
      <description>Hi, &lt;BR /&gt;Compiler : aCC &lt;BR /&gt;Platform : IA &lt;BR /&gt;OS : 11iv3 &lt;BR /&gt;&lt;BR /&gt;Doubt : &lt;BR /&gt;My question is over the stack space returned by a function after the function returns. &lt;BR /&gt;&lt;BR /&gt;When a function call returns, what happens to the stack space? Is it cleaned (zeroed out)? &lt;BR /&gt;When a new function call happens in the same context is the same space re-used for that function or a new block of memory (but not the one used in the previously returned function) is allocated? Is there a way by means of flag to tell the Compiler to erase and then allocate. &lt;BR /&gt;Is this behavior of Stack Space Compiler dependent? or OS Dependent? &lt;BR /&gt;&lt;BR /&gt;Has it anything to do with the Linker/Loader? (I don't think so tough ...) &lt;BR /&gt;&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Wed, 10 Mar 2010 12:41:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598291#M679703</guid>
      <dc:creator>RW-S</dc:creator>
      <dc:date>2010-03-10T12:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Treatment of Stack Space used for Function Calls</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598292#M679704</link>
      <description>To make the problem even more clear - &lt;BR /&gt;&lt;BR /&gt;main() {&lt;BR /&gt;char *a[2]; &lt;BR /&gt;foo (a); &lt;BR /&gt;bar (a); &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;foo() { &lt;BR /&gt;char c[20], d[20]; &lt;BR /&gt;a[0]=c; &lt;BR /&gt;a[1]=d;&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;bar() { &lt;BR /&gt;printf(a[0],a[1]);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Here, even tough the arrays a and b have been destroyed after the function call of foo() has been done with, they still show the same value when the value of a is printed in the bar() function.</description>
      <pubDate>Wed, 10 Mar 2010 13:13:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598292#M679704</guid>
      <dc:creator>RW-S</dc:creator>
      <dc:date>2010-03-10T13:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Treatment of Stack Space used for Function Calls</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598293#M679705</link>
      <description>&amp;gt;what happens to the stack space?&lt;BR /&gt;&lt;BR /&gt;It stays until overwritten.  This could be randomly due to signals.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;is the same space re-used for that function&lt;BR /&gt;&lt;BR /&gt;That's why it's called a stack, it is reused.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Is there a way by means of flag to tell the compiler to erase and then allocate.&lt;BR /&gt;&lt;BR /&gt;No.  You must initialize your own objects.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;even though the arrays a and b have been destroyed&lt;BR /&gt;&lt;BR /&gt;(Only C++ objects are destroyed.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;they still show the same value when the value of a is printed in the bar() function.&lt;BR /&gt;&lt;BR /&gt;This is illegal, you shouldn't depend on this.</description>
      <pubDate>Wed, 10 Mar 2010 16:25:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598293#M679705</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-03-10T16:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Treatment of Stack Space used for Function Calls</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598294#M679706</link>
      <description>If you are happy with the answers you were given, please read the following about how to assign points:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;</description>
      <pubDate>Fri, 12 Mar 2010 20:15:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598294#M679706</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-03-12T20:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Treatment of Stack Space used for Function Calls</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598295#M679707</link>
      <description>stack space reduction is a chanllenge and devellopers work hard to reduce number of elements pushed onto a program's stack space during program execution... there are tools/commpilers  to help with code optimization. &lt;BR /&gt;t#&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Mar 2010 14:01:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/treatment-of-stack-space-used-for-function-calls/m-p/4598295#M679707</guid>
      <dc:creator>T. M. Louah</dc:creator>
      <dc:date>2010-03-13T14:01:08Z</dc:date>
    </item>
  </channel>
</rss>

