<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: C++ on the Palm: No class for data storage</title>
	<atom:link href="http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/feed/" rel="self" type="application/rss+xml" />
	<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/</link>
	<description>A blog on technical stuff by Steven Fisher. Cat pictures not included.</description>
	<pubDate>Tue, 06 Jan 2009 20:50:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mx</title>
		<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/comment-page-1/#comment-36</link>
		<dc:creator>mx</dc:creator>
		<pubDate>Sun, 07 Aug 2005 16:51:21 +0000</pubDate>
		<guid isPermaLink="false">http://objectsatrest.com/2005/07/c-on-the-palm-no-class-for-data-storage/#comment-36</guid>
		<description>Yes, auto_ptr-style classes themselves are heap (or stack) allocated, but their data can be anywhere.  Multiple new or deletes can be proxied, by either fronting with builder/factories or similar.</description>
		<content:encoded><![CDATA[<p>Yes, auto_ptr-style classes themselves are heap (or stack) allocated, but their data can be anywhere.  Multiple new or deletes can be proxied, by either fronting with builder/factories or similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Fisher</title>
		<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/comment-page-1/#comment-34</link>
		<dc:creator>Steven Fisher</dc:creator>
		<pubDate>Thu, 04 Aug 2005 17:36:41 +0000</pubDate>
		<guid isPermaLink="false">http://objectsatrest.com/2005/07/c-on-the-palm-no-class-for-data-storage/#comment-34</guid>
		<description>How do you manage multiple new/deletes? I'm going to have to allocate some interface objects in the heap regardless.</description>
		<content:encoded><![CDATA[<p>How do you manage multiple new/deletes? I&#8217;m going to have to allocate some interface objects in the heap regardless.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mx</title>
		<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/comment-page-1/#comment-33</link>
		<dc:creator>mx</dc:creator>
		<pubDate>Thu, 04 Aug 2005 17:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://objectsatrest.com/2005/07/c-on-the-palm-no-class-for-data-storage/#comment-33</guid>
		<description>You could also overload new/delete, in addition to a builder/factory layer to allow you to control where objects are stored.  This would likely require proxies (like an auto_ptr) for general access though, which gets ugly (and complicated) quickly, though may be worth the effort for the platform.

But, I'm not sure C++ is worth it on that platform.</description>
		<content:encoded><![CDATA[<p>You could also overload new/delete, in addition to a builder/factory layer to allow you to control where objects are stored.  This would likely require proxies (like an auto_ptr) for general access though, which gets ugly (and complicated) quickly, though may be worth the effort for the platform.</p>
<p>But, I&#8217;m not sure C++ is worth it on that platform.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Fisher</title>
		<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/comment-page-1/#comment-29</link>
		<dc:creator>Steven Fisher</dc:creator>
		<pubDate>Wed, 27 Jul 2005 20:03:04 +0000</pubDate>
		<guid isPermaLink="false">http://objectsatrest.com/2005/07/c-on-the-palm-no-class-for-data-storage/#comment-29</guid>
		<description>To clarify, this is what I had (forgive any imperfections, this is pseudo-code, and I'm not a great C++ programmer yet):

&lt;code&gt;class CSpreadsheet
{
  CList m_Tasks;
};&lt;/code&gt;

This is what I expect to have now:

&lt;code&gt;class CSpreadsheetViewer
{
  void FindByRecID( RecID recID );
  UInt16 GetColumnCount();
  RecID GetColumnN( UInt16 n );
};

class CTaskViewer
{
  void FindByRecID( RecID recID );
};&lt;/code&gt;

Obviously, the first is more pure C++. But the second is probably going to be more useful on the Palm.</description>
		<content:encoded><![CDATA[<p>To clarify, this is what I had (forgive any imperfections, this is pseudo-code, and I&#8217;m not a great C++ programmer yet):</p>
<p><code>class CSpreadsheet<br />
{<br />
  CList m_Tasks;<br />
};</code></p>
<p>This is what I expect to have now:</p>
<p><code>class CSpreadsheetViewer<br />
{<br />
  void FindByRecID( RecID recID );<br />
  UInt16 GetColumnCount();<br />
  RecID GetColumnN( UInt16 n );<br />
};</p>
<p>class CTaskViewer<br />
{<br />
  void FindByRecID( RecID recID );<br />
};</code></p>
<p>Obviously, the first is more pure C++. But the second is probably going to be more useful on the Palm.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Fisher</title>
		<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/comment-page-1/#comment-28</link>
		<dc:creator>Steven Fisher</dc:creator>
		<pubDate>Wed, 27 Jul 2005 19:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://objectsatrest.com/2005/07/c-on-the-palm-no-class-for-data-storage/#comment-28</guid>
		<description>Hi Jonathan,

Yes, what I'm talking about is heap (and stack, to be fair) vs. storage. Serializing is a fix for the problem, and it's something I considered for a while, but by serializing the objects we introduce the cost I mentioned in switching applications: Namely, objects need to be saved when the application is switched out, and restored when switched back. I'm not talking about a dozen objects here, but thousands. That is, of course, if I intend to treat all of my data as C++ objects instead of datatable record IDs.

C++ objects &lt;i&gt;could&lt;/i&gt; be a way to handle this. Some way to create C++ objects in storage and reference C++ objects by record ID woud solve these problems, but there seems to be some compiler work needed there. Codewarrior is closed source and dead, and PRC is nowhere near usable as yet (and may never be, since everyone seems to be distracted by the pretty lights of Copland... err, I mean, Cobalt).

Thanks for the comment, though. Sorry something cut it off. :)</description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>Yes, what I&#8217;m talking about is heap (and stack, to be fair) vs. storage. Serializing is a fix for the problem, and it&#8217;s something I considered for a while, but by serializing the objects we introduce the cost I mentioned in switching applications: Namely, objects need to be saved when the application is switched out, and restored when switched back. I&#8217;m not talking about a dozen objects here, but thousands. That is, of course, if I intend to treat all of my data as C++ objects instead of datatable record IDs.</p>
<p>C++ objects <i>could</i> be a way to handle this. Some way to create C++ objects in storage and reference C++ objects by record ID woud solve these problems, but there seems to be some compiler work needed there. Codewarrior is closed source and dead, and PRC is nowhere near usable as yet (and may never be, since everyone seems to be distracted by the pretty lights of Copland&#8230; err, I mean, Cobalt).</p>
<p>Thanks for the comment, though. Sorry something cut it off. <img src='http://tewha.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Hays</title>
		<link>http://tewha.net/2005/07/c-on-the-palm-no-class-for-data-storage/comment-page-1/#comment-27</link>
		<dc:creator>Jonathan Hays</dc:creator>
		<pubDate>Wed, 27 Jul 2005 17:36:21 +0000</pubDate>
		<guid isPermaLink="false">http://objectsatrest.com/2005/07/c-on-the-palm-no-class-for-data-storage/#comment-27</guid>
		<description>Not sure exactly why you think that.  Just to clarify from your post, in C++, classes only use heap storage if you make them that way.  Here's an example:

class Foo
{
    public:
    Foo() : member(new Bar(initData))
    {
    }

    Bar* member;
};

class Foo
{
    public:
    Foo() : member(initData)
    {
    }

    Bar member;
};

In the first example, if you create a Foo object on the stack, then yes, you are correct, the member variable will be created on the heap.  However, if you use the second definition of Foo, everything will be pushed onto the stack.
Now, I'm rereading your post, and this still doesn't address your issue.  If I understand what you're saying, you want to have a class and be able to store its state externally.  Basically, you need to serialize your classes.  This is a fairly well explored topic, and what most people use to address this is the &#62;&#62; and </description>
		<content:encoded><![CDATA[<p>Not sure exactly why you think that.  Just to clarify from your post, in C++, classes only use heap storage if you make them that way.  Here&#8217;s an example:</p>
<p>class Foo<br />
{<br />
    public:<br />
    Foo() : member(new Bar(initData))<br />
    {<br />
    }</p>
<p>    Bar* member;<br />
};</p>
<p>class Foo<br />
{<br />
    public:<br />
    Foo() : member(initData)<br />
    {<br />
    }</p>
<p>    Bar member;<br />
};</p>
<p>In the first example, if you create a Foo object on the stack, then yes, you are correct, the member variable will be created on the heap.  However, if you use the second definition of Foo, everything will be pushed onto the stack.<br />
Now, I&#8217;m rereading your post, and this still doesn&#8217;t address your issue.  If I understand what you&#8217;re saying, you want to have a class and be able to store its state externally.  Basically, you need to serialize your classes.  This is a fairly well explored topic, and what most people use to address this is the &gt;&gt; and</p>
]]></content:encoded>
	</item>
</channel>
</rss>
