<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Slowly going back to C.. again !</title>
	<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/</link>
	<description>DFWBL !!!</description>
	<pubDate>Fri, 18 May 2012 15:13:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: ragin' lion</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-296</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-296</guid>
					<description>Mr. Kaz, have you tried the &lt;A HREF=&quot;http://www.digitalmars.com/d/&quot; REL=&quot;nofollow&quot;&gt;D Programming Language&lt;/A&gt;?&lt;BR/&gt;&lt;BR/&gt;Oh you haven't?  I haven't either! 8P  It does have some interesting constructs, but (at the moment) I don't know of any &quot;serious&quot; commercial applications that use the language.&lt;BR/&gt;&lt;BR/&gt;A lot of the C++ issues you raise are true ... it is a pain, but (like I've always said) the true &quot;power&quot; lies in using only the language features that are necessary and at least make your code less buggy.&lt;BR/&gt;&lt;BR/&gt;Depending on the context having a class with the member variables initialized in the initializer list is a lot less buggy than a struct where you have to initialize things &quot;by hand&quot; or the like.&lt;BR/&gt;&lt;BR/&gt;頑張ってね！</description>
		<content:encoded><![CDATA[<p>Mr. Kaz, have you tried the <A HREF="http://www.digitalmars.com/d/" REL="nofollow">D Programming Language</A>?<BR/><BR/>Oh you haven&#8217;t?  I haven&#8217;t either! 8P  It does have some interesting constructs, but (at the moment) I don&#8217;t know of any &#8220;serious&#8221; commercial applications that use the language.<BR/><BR/>A lot of the C++ issues you raise are true &#8230; it is a pain, but (like I&#8217;ve always said) the true &#8220;power&#8221; lies in using only the language features that are necessary and at least make your code less buggy.<BR/><BR/>Depending on the context having a class with the member variables initialized in the initializer list is a lot less buggy than a struct where you have to initialize things &#8220;by hand&#8221; or the like.<BR/><BR/>頑張ってね！
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Anonymous</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-297</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-297</guid>
					<description>ragin' lion said...&lt;BR/&gt;&lt;BR/&gt;&quot;Depending on the context having a class with the member variables initialized in the initializer list is a lot less buggy than a struct where you have to initialize things &quot;by hand&quot; or the like.&quot;&lt;BR/&gt;&lt;BR/&gt;Oh yeah, rely on the compiler to decide when things are initialized and freed, sure... a lot safer than doing it yourself and being in complete control of the order...</description>
		<content:encoded><![CDATA[<p>ragin&#8217; lion said&#8230;<BR/><BR/>&#8220;Depending on the context having a class with the member variables initialized in the initializer list is a lot less buggy than a struct where you have to initialize things &#8220;by hand&#8221; or the like.&#8221;<BR/><BR/>Oh yeah, rely on the compiler to decide when things are initialized and freed, sure&#8230; a lot safer than doing it yourself and being in complete control of the order&#8230;
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ragin' lion</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-298</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-298</guid>
					<description>Rince, is that you? 8P&lt;BR/&gt;&lt;BR/&gt;Anyway, that example you raise is a case in which it may not be wise to do that.&lt;BR/&gt;&lt;BR/&gt;The example I was thinking about was something like:&lt;BR/&gt;&lt;BR/&gt;class CVector3f&lt;BR/&gt;{&lt;BR/&gt;public:&lt;BR/&gt;    CVector3f()&lt;BR/&gt;    :x(0),y(0),(0){}&lt;BR/&gt;&lt;BR/&gt;    float x,y,z;&lt;BR/&gt;};&lt;BR/&gt;&lt;BR/&gt;rather than:&lt;BR/&gt;&lt;BR/&gt;struct SVector3f&lt;BR/&gt;{&lt;BR/&gt;    float x,y,z;&lt;BR/&gt;};&lt;BR/&gt;&lt;BR/&gt;SVector3f v0;&lt;BR/&gt;v0.x = v0.y = v0.z = 0.0f;&lt;BR/&gt;&lt;BR/&gt;No memory allocations there ...&lt;BR/&gt;&lt;BR/&gt;As I mentioned before, &quot;the true 'power' lies in using only the language features that are &lt;I&gt;necessary&lt;/I&gt;...&quot;&lt;BR/&gt;&lt;BR/&gt;If (based on your design needs) certain language features aren't needed, don't use it.  Less is sometimes better.&lt;BR/&gt;&lt;BR/&gt;I'm not trying to make arguments that &quot;C++ is superior to C&quot; or vice versa.  To me, a programming language is a tool to get some task done.  If C works great for the job, do it in C.  In my case C++ has been very useful for the projects I've worked on and I really don't have too many complaints at this point.  Yeah, it was a pain to learn and deal with initially, but looking back, it's definately worth it.&lt;BR/&gt;&lt;BR/&gt;&lt;A HREF=&quot;http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html&quot; REL=&quot;nofollow&quot;&gt;C99/C9X&lt;/A&gt; has some nice improvements to the C language.  Perhaps those new features/improvements might be what you need rather than what's in C++?</description>
		<content:encoded><![CDATA[<p>Rince, is that you? 8P<BR/><BR/>Anyway, that example you raise is a case in which it may not be wise to do that.<BR/><BR/>The example I was thinking about was something like:<BR/><BR/>class CVector3f<BR/>{<BR/>public:<BR/>    CVector3f()<BR/>    :x(0),y(0),(0){}<BR/><BR/>    float x,y,z;<BR/>};<BR/><BR/>rather than:<BR/><BR/>struct SVector3f<BR/>{<BR/>    float x,y,z;<BR/>};<BR/><BR/>SVector3f v0;<BR/>v0.x = v0.y = v0.z = 0.0f;<BR/><BR/>No memory allocations there &#8230;<BR/><BR/>As I mentioned before, &#8220;the true &#8216;power&#8217; lies in using only the language features that are <I>necessary</I>&#8230;&#8221;<BR/><BR/>If (based on your design needs) certain language features aren&#8217;t needed, don&#8217;t use it.  Less is sometimes better.<BR/><BR/>I&#8217;m not trying to make arguments that &#8220;C++ is superior to C&#8221; or vice versa.  To me, a programming language is a tool to get some task done.  If C works great for the job, do it in C.  In my case C++ has been very useful for the projects I&#8217;ve worked on and I really don&#8217;t have too many complaints at this point.  Yeah, it was a pain to learn and deal with initially, but looking back, it&#8217;s definately worth it.<BR/><BR/><A HREF="http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html" REL="nofollow">C99/C9X</A> has some nice improvements to the C language.  Perhaps those new features/improvements might be what you need rather than what&#8217;s in C++?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: rince</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-299</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-299</guid>
					<description>Funny that you mention that particular example, in one of the previous projects that I've worked on we have something like that for the math library, so all vectors and matrices were being initialized to 0's 'behind the scene', and then guess what showed up at the top of CPU usage during performance profiling? &lt;BR/&gt;&lt;BR/&gt;All the vector and matrix constructors!&lt;BR/&gt;&lt;BR/&gt;So your example just further proves my point. If I want to set a vector or a matrix to 0 then force me do it manually when I need it and dont hide it away from me!! =)</description>
		<content:encoded><![CDATA[<p>Funny that you mention that particular example, in one of the previous projects that I&#8217;ve worked on we have something like that for the math library, so all vectors and matrices were being initialized to 0&#8217;s &#8216;behind the scene&#8217;, and then guess what showed up at the top of CPU usage during performance profiling? <BR/><BR/>All the vector and matrix constructors!<BR/><BR/>So your example just further proves my point. If I want to set a vector or a matrix to 0 then force me do it manually when I need it and dont hide it away from me!! =)
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ragin' lion</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-300</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-300</guid>
					<description>Was that your anonymous post rince? 8P  I had a feeling that that example would get shot at ... but yeah, that very example would be a performance killer.&lt;BR/&gt;&lt;BR/&gt;You could optionally do this:&lt;BR/&gt;&lt;BR/&gt;class CVector3f&lt;BR/&gt;{&lt;BR/&gt;public:&lt;BR/&gt;CVector3f(){}&lt;BR/&gt;CVector3f( float _x, float _y, float _z )&lt;BR/&gt;:x(_x),y(_y),z(_z){}&lt;BR/&gt;&lt;BR/&gt;float x,y,z;&lt;BR/&gt;};&lt;BR/&gt;&lt;BR/&gt;I had ran into situations where these bugs would pop up because of uninitialized data ... that was annoying.  For vector initialization the above style should be ok, for matrices, it's a bad idea (especially if you're skinning or the like).&lt;BR/&gt;&lt;BR/&gt;But I think you get the point I'm trying to make, right? 8P&lt;BR/&gt;&lt;BR/&gt;Hopefully some newer, better language than C &amp; C++ will emerge eventually.</description>
		<content:encoded><![CDATA[<p>Was that your anonymous post rince? 8P  I had a feeling that that example would get shot at &#8230; but yeah, that very example would be a performance killer.<BR/><BR/>You could optionally do this:<BR/><BR/>class CVector3f<BR/>{<BR/>public:<BR/>CVector3f(){}<BR/>CVector3f( float _x, float _y, float _z )<BR/>:x(_x),y(_y),z(_z){}<BR/><BR/>float x,y,z;<BR/>};<BR/><BR/>I had ran into situations where these bugs would pop up because of uninitialized data &#8230; that was annoying.  For vector initialization the above style should be ok, for matrices, it&#8217;s a bad idea (especially if you&#8217;re skinning or the like).<BR/><BR/>But I think you get the point I&#8217;m trying to make, right? 8P<BR/><BR/>Hopefully some newer, better language than C &#038; C++ will emerge eventually.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Davide Pasca</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-301</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-301</guid>
					<description>When performance comes into play, OOP can be a real pain. That's what I experienced with Java. Where every vector wanted to be an object (ouch).&lt;BR/&gt;&lt;BR/&gt;The safe initialization is useful and spares from bugs (in C I normally do a memset() or so), however it can be a problem. Actually the constructor for the 3D vector thing was also my biggest issue with C++ a decade ago, when I first tried it with the Borland compiler (would do something even with no destructor !).&lt;BR/&gt;Nowadays I think that one can just avoid placing the costructor and destructor, to be sure that a structure can be used just as an interface to a chunk of memory (what's needed for performance).&lt;BR/&gt;&lt;BR/&gt;In the end, I guess a distinction has to be made between what should be an object and what shouldn't.&lt;BR/&gt;There are classes that don't need multiple instances, then there are classes that need multiple instances but not so many of them, then there are classes that are instanced so many times that the issue becomes time critical.&lt;BR/&gt;&lt;BR/&gt;OOP will do for the first two cases, but for the third one.. better not get fancy.</description>
		<content:encoded><![CDATA[<p>When performance comes into play, OOP can be a real pain. That&#8217;s what I experienced with Java. Where every vector wanted to be an object (ouch).<BR/><BR/>The safe initialization is useful and spares from bugs (in C I normally do a memset() or so), however it can be a problem. Actually the constructor for the 3D vector thing was also my biggest issue with C++ a decade ago, when I first tried it with the Borland compiler (would do something even with no destructor !).<BR/>Nowadays I think that one can just avoid placing the costructor and destructor, to be sure that a structure can be used just as an interface to a chunk of memory (what&#8217;s needed for performance).<BR/><BR/>In the end, I guess a distinction has to be made between what should be an object and what shouldn&#8217;t.<BR/>There are classes that don&#8217;t need multiple instances, then there are classes that need multiple instances but not so many of them, then there are classes that are instanced so many times that the issue becomes time critical.<BR/><BR/>OOP will do for the first two cases, but for the third one.. better not get fancy.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ragin' lion</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-302</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-302</guid>
					<description>Kaz, it sounds like you're seeing the point(s) I was trying to make.  Perhaps my English isn't so good anymore these days.  It's a little tricky explain things now in English.  日本語で書きましょうか。 8)&lt;BR/&gt;&lt;BR/&gt;Which C++ compiler are you currently using?  For sure, the C++ compiler technology has greatly improved.  I'm not sure which is the best, but it seems that &lt;A HREF=&quot;http://www.gnu.org/software/gcc/gcc.html&quot; REL=&quot;nofollow&quot;&gt;gcc&lt;/A&gt; is on the top-10 list.&lt;BR/&gt;&lt;BR/&gt;Microsoft's &lt;A HREF=&quot;http://lab.msdn.microsoft.com/vs2005/&quot; REL=&quot;nofollow&quot;&gt;Visual Studio 2005&lt;/A&gt; seems to have some really nice and modern abilities (the XBox360 compiler suite might have similar functionality).  Not sure what's on PS2 ... For PS3, it will probably be some variant of gcc since Sony now owns SN Systems.&lt;BR/&gt;&lt;BR/&gt;&lt;A HREF=&quot;http://www.amazon.com/exec/obidos/tg/detail/-/0201834545/102-3975651-4936960?v=glance&quot; REL=&quot;nofollow&quot;&gt;Inside the C++ Object Model&lt;/A&gt; has a nice overview of what's going on behind the scenes.  It's dry reading at times, but you'll realize what and what not to do depending on the design needs of your situation.</description>
		<content:encoded><![CDATA[<p>Kaz, it sounds like you&#8217;re seeing the point(s) I was trying to make.  Perhaps my English isn&#8217;t so good anymore these days.  It&#8217;s a little tricky explain things now in English.  日本語で書きましょうか。 8)<BR/><BR/>Which C++ compiler are you currently using?  For sure, the C++ compiler technology has greatly improved.  I&#8217;m not sure which is the best, but it seems that <A HREF="http://www.gnu.org/software/gcc/gcc.html" REL="nofollow">gcc</A> is on the top-10 list.<BR/><BR/>Microsoft&#8217;s <A HREF="http://lab.msdn.microsoft.com/vs2005/" REL="nofollow">Visual Studio 2005</A> seems to have some really nice and modern abilities (the XBox360 compiler suite might have similar functionality).  Not sure what&#8217;s on PS2 &#8230; For PS3, it will probably be some variant of gcc since Sony now owns SN Systems.<BR/><BR/><A HREF="http://www.amazon.com/exec/obidos/tg/detail/-/0201834545/102-3975651-4936960?v=glance" REL="nofollow">Inside the C++ Object Model</A> has a nice overview of what&#8217;s going on behind the scenes.  It&#8217;s dry reading at times, but you&#8217;ll realize what and what not to do depending on the design needs of your situation.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: rince</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-303</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-303</guid>
					<description>Well the compromise that works for me is using the 'static' keyword a lot and avoiding inheritance, templates, operator overriding. By doing that I seem to inheritantly avoid all the undesireable c++ issues. If I get a bug in my code then it is always due to 'normal' causes like un-initialized variables, memory overwrites, incorrect logic, etc... and those are by nature isolated, identifiable and can be fixed without affecting the scope of the rest of the project. &lt;BR/&gt;&lt;BR/&gt;I think that by declaring everything static I am compliant with the OOP principles by the virtue of all my data and code being local to a particular module.</description>
		<content:encoded><![CDATA[<p>Well the compromise that works for me is using the &#8217;static&#8217; keyword a lot and avoiding inheritance, templates, operator overriding. By doing that I seem to inheritantly avoid all the undesireable c++ issues. If I get a bug in my code then it is always due to &#8216;normal&#8217; causes like un-initialized variables, memory overwrites, incorrect logic, etc&#8230; and those are by nature isolated, identifiable and can be fixed without affecting the scope of the rest of the project. <BR/><BR/>I think that by declaring everything static I am compliant with the OOP principles by the virtue of all my data and code being local to a particular module.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Davide Pasca</title>
		<link>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-304</link>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://v3.kazzuya.com/slowly-going-back-to-c-again/#comment-304</guid>
					<description>Ragin: 説明のための、日本語の方がいいと言う意味ですか？どうぞ...(^.^)&lt;BR/&gt;&lt;BR/&gt;Rince: I think that that's more or less modular programming. Which is what is needed in most cases. However it has earned a bad name because it's an old paradigm which doesn't really propose a strong set of rules and concepts like OOP does.&lt;BR/&gt;Strangely enough OOP throught C++ goes against that basic concept of modular/black-box programming, by making everything public.&lt;BR/&gt;&lt;BR/&gt;Generally I'd say that most code doesn't need to belong to any object (one instance). Then, perhaps one may need multiple instances of a module, and things can pretty much stay the same, just by adding a context switch function.&lt;BR/&gt;&lt;BR/&gt;So, instead of having:&lt;BR/&gt;&lt;BR/&gt;mycontext.DrawLine();&lt;BR/&gt;mycontext.DrawCircle();&lt;BR/&gt;&lt;BR/&gt;..one can do..&lt;BR/&gt;&lt;BR/&gt;SetContext( mycontext );&lt;BR/&gt;DrawLine();&lt;BR/&gt;DrawCircle();&lt;BR/&gt;&lt;BR/&gt;The added benefit is that the second system actually pushes for explicit namespaces. So one will have:&lt;BR/&gt;&lt;BR/&gt;MyLib_SetContext( mycontext );&lt;BR/&gt;MyLib_DrawLine();&lt;BR/&gt;MyLib_DrawCircle();&lt;BR/&gt;&lt;BR/&gt;..which I think I generally much more clear, while not taking anymore space than the OO version.&lt;BR/&gt;&lt;BR/&gt;As far as inheritance goes.. I can see it useful in cases in which one uses virtual methods. Avoids some hand made switches.. however I'm still with the fact that most code doesn't really need all those features.&lt;BR/&gt;&lt;BR/&gt;Templates came in handy for variable sized arrays. They could handle my trees too, however the implementations I saw, didn't impress me with performance as I generally wish to have the node pointers directly into my node structure, not wrapped around it ..like for the implementations that I could find around.</description>
		<content:encoded><![CDATA[<p>Ragin: 説明のための、日本語の方がいいと言う意味ですか？どうぞ&#8230;(^.^)<BR/><BR/>Rince: I think that that&#8217;s more or less modular programming. Which is what is needed in most cases. However it has earned a bad name because it&#8217;s an old paradigm which doesn&#8217;t really propose a strong set of rules and concepts like OOP does.<BR/>Strangely enough OOP throught C++ goes against that basic concept of modular/black-box programming, by making everything public.<BR/><BR/>Generally I&#8217;d say that most code doesn&#8217;t need to belong to any object (one instance). Then, perhaps one may need multiple instances of a module, and things can pretty much stay the same, just by adding a context switch function.<BR/><BR/>So, instead of having:<BR/><BR/>mycontext.DrawLine();<BR/>mycontext.DrawCircle();<BR/><BR/>..one can do..<BR/><BR/>SetContext( mycontext );<BR/>DrawLine();<BR/>DrawCircle();<BR/><BR/>The added benefit is that the second system actually pushes for explicit namespaces. So one will have:<BR/><BR/>MyLib_SetContext( mycontext );<BR/>MyLib_DrawLine();<BR/>MyLib_DrawCircle();<BR/><BR/>..which I think I generally much more clear, while not taking anymore space than the OO version.<BR/><BR/>As far as inheritance goes.. I can see it useful in cases in which one uses virtual methods. Avoids some hand made switches.. however I&#8217;m still with the fact that most code doesn&#8217;t really need all those features.<BR/><BR/>Templates came in handy for variable sized arrays. They could handle my trees too, however the implementations I saw, didn&#8217;t impress me with performance as I generally wish to have the node pointers directly into my node structure, not wrapped around it ..like for the implementations that I could find around.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>

