<?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: 4.6 &#8212; Typedefs</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/46-typedefs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 21:20:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: george</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-96180</link>
		<dc:creator>george</dc:creator>
		<pubDate>Sun, 23 Oct 2011 07:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-96180</guid>
		<description>I would think this:

#define int* intptrdef;
intptrdef pZ, pW;

translates to  this:
int* pZ, pW

in which case both should be pointers.</description>
		<content:encoded><![CDATA[<p>I would think this:</p>
<p>#define int* intptrdef;<br />
intptrdef pZ, pW;</p>
<p>translates to  this:<br />
int* pZ, pW</p>
<p>in which case both should be pointers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SJ</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-95404</link>
		<dc:creator>SJ</dc:creator>
		<pubDate>Tue, 03 May 2011 07:02:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-95404</guid>
		<description>Hi,

Will you please explain me following typedef:

typedef WCHAR TCHAR, *PTCHAR, PTSTR;

(Term means: WCHAR - wide character
             TCHAR - generic character
             *PTCHAR - pointer to generic character
             PTSTR - pointer to generic string. )

Will you please explain me how i can get this typedef and how can i use this typedef.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Will you please explain me following typedef:</p>
<p>typedef WCHAR TCHAR, *PTCHAR, PTSTR;</p>
<p>(Term means: WCHAR &#8211; wide character<br />
             TCHAR &#8211; generic character<br />
             *PTCHAR &#8211; pointer to generic character<br />
             PTSTR &#8211; pointer to generic string. )</p>
<p>Will you please explain me how i can get this typedef and how can i use this typedef.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learner</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-93397</link>
		<dc:creator>Learner</dc:creator>
		<pubDate>Wed, 06 Oct 2010 07:58:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-93397</guid>
		<description>And just what does this have to do with C++ ?</description>
		<content:encoded><![CDATA[<p>And just what does this have to do with C++ ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matsolof</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-92078</link>
		<dc:creator>matsolof</dc:creator>
		<pubDate>Wed, 15 Sep 2010 09:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-92078</guid>
		<description>I simply must comment on the smaller size and larger size javascripts, that I just discovered. I think they are really useful and that similar functions should be used much more on the web than they are.

If you want to see an example of a similar technique, go to my image gallery &lt;a href=&quot;http://www.mkforlag.com/eng_images/pompei&quot; rel=&quot;nofollow&quot;&gt;Pompei&lt;/a&gt; with images from, not very surprisingly, Pompei.</description>
		<content:encoded><![CDATA[<p>I simply must comment on the smaller size and larger size javascripts, that I just discovered. I think they are really useful and that similar functions should be used much more on the web than they are.</p>
<p>If you want to see an example of a similar technique, go to my image gallery <a href="http://www.mkforlag.com/eng_images/pompei" rel="nofollow">Pompei</a> with images from, not very surprisingly, Pompei.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matsolof</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-92073</link>
		<dc:creator>matsolof</dc:creator>
		<pubDate>Wed, 15 Sep 2010 08:12:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-92073</guid>
		<description>An alternative to using typedefs would of course be using comments, for example:

&lt;pre&gt;long nDistance; // miles&lt;/pre&gt;

I prefer using comments for at least three reasons:

1. You only need one line of code (if you, like me, want a linebreak after each semicolon, that is).

2. There&#039;s one keyword (typedef) less to learn how to use, and you can learn to use something else instead.

3. The risk of making a mistake is greatly reduced. In other words, if you make a typo inside a comment it doesn&#039;t matter while it usually does if you make one outside a comment.</description>
		<content:encoded><![CDATA[<p>An alternative to using typedefs would of course be using comments, for example:</p>
<pre>long nDistance; // miles</pre>
<p>I prefer using comments for at least three reasons:</p>
<p>1. You only need one line of code (if you, like me, want a linebreak after each semicolon, that is).</p>
<p>2. There&#8217;s one keyword (typedef) less to learn how to use, and you can learn to use something else instead.</p>
<p>3. The risk of making a mistake is greatly reduced. In other words, if you make a typo inside a comment it doesn&#8217;t matter while it usually does if you make one outside a comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gerald Parsons</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-88730</link>
		<dc:creator>Gerald Parsons</dc:creator>
		<pubDate>Mon, 19 Jul 2010 19:49:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-88730</guid>
		<description>I understand the typedef stuff ok but the :
&lt;pre&gt;
#ifdef INT_2_BYTES
typedef char int8;
typedef int int16;
typedef long int32;
#else
typedef char int8;
typedef short int16;
typedef int int32;
#endif
&lt;/pre&gt;
This just lost me good.
Where is the if else coming from. If &quot;what&quot; or else &quot;why&quot;. Is the preprocessor comparing something? Or is this an example of code that could be written?
Your tutorial is great, it is filling in a lot of holes I had in my attempt to teach myself c++. My problem is that my brain has very little RAM. I guess I chewed on too many lead bars when I was kid. It was ok back then to chew on lead bars, 60 years ago you didn&#039;t need brains like today. I was going to do a site on learning c++ but I can&#039;t beat this site so I will put links on my sites leading to yours. This is pro stuff you got, real education taught by an educator.
thanks</description>
		<content:encoded><![CDATA[<p>I understand the typedef stuff ok but the :</p>
<pre>
#ifdef INT_2_BYTES
typedef char int8;
typedef int int16;
typedef long int32;
#else
typedef char int8;
typedef short int16;
typedef int int32;
#endif
</pre>
<p>This just lost me good.<br />
Where is the if else coming from. If &#8220;what&#8221; or else &#8220;why&#8221;. Is the preprocessor comparing something? Or is this an example of code that could be written?<br />
Your tutorial is great, it is filling in a lot of holes I had in my attempt to teach myself c++. My problem is that my brain has very little RAM. I guess I chewed on too many lead bars when I was kid. It was ok back then to chew on lead bars, 60 years ago you didn&#8217;t need brains like today. I was going to do a site on learning c++ but I can&#8217;t beat this site so I will put links on my sites leading to yours. This is pro stuff you got, real education taught by an educator.<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gundoganfa</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-63455</link>
		<dc:creator>gundoganfa</dc:creator>
		<pubDate>Tue, 30 Jun 2009 22:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-63455</guid>
		<description>exactly correct.</description>
		<content:encoded><![CDATA[<p>exactly correct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zak</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-63021</link>
		<dc:creator>Zak</dc:creator>
		<pubDate>Wed, 24 Jun 2009 20:40:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-63021</guid>
		<description>Well what is obviously missing is the int main() section. I took the code and copied it and added the int main() section and it worked perfectly.

&lt;pre&gt;

#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

typedef double DistanceCovered;

DistanceCovered InKilomtres()
{
    using namespace std;
    float speed;
    cout &lt;&lt; &quot;Please enter the speed in km/hr:&quot; &lt;&lt; endl;
    cin &gt;&gt; speed;
    float time;
    cout &lt;&lt; &quot;Please enter the time taken in hours:&quot; &lt;&lt; endl;
    cin &gt;&gt; time;

    //I added this because it was not printing the answer anywhere.
    cout &lt;&lt; &quot;You travelled &quot; &lt;&lt; speed * time &lt;&lt; &quot; kilometers.&quot; &lt;&lt; endl;
    return speed * time;
}

int main()
{
	InKilomtres();
	return 0;
}
&lt;!--formatted--&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Well what is obviously missing is the int main() section. I took the code and copied it and added the int main() section and it worked perfectly.</p>
<pre>

#include &quot;stdafx.h&quot;
#include &lt;iostream&gt;

typedef double DistanceCovered;

DistanceCovered InKilomtres()
{
    using namespace std;
    float speed;
    cout &lt;&lt; &quot;Please enter the speed in km/hr:&quot; &lt;&lt; endl;
    cin &gt;&gt; speed;
    float time;
    cout &lt;&lt; &quot;Please enter the time taken in hours:&quot; &lt;&lt; endl;
    cin &gt;&gt; time;

    //I added this because it was not printing the answer anywhere.
    cout &lt;&lt; "You travelled " &lt;&lt; speed * time &lt;&lt; " kilometers." &lt;&lt; endl;
    return speed * time;
}

int main()
{
	InKilomtres();
	return 0;
}
<!--formatted--></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learner</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-62483</link>
		<dc:creator>Learner</dc:creator>
		<pubDate>Mon, 15 Jun 2009 23:22:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-62483</guid>
		<description>Sorry, but I don&#039;t really understand this part of the tutorials.
What I&#039;m guessing is that:
&lt;pre&gt;
long lVar;
&lt;/pre&gt;

is the same as:
&lt;pre&gt;
typedef long LongChars;
LongChars lVar;
&lt;/pre&gt;

?</description>
		<content:encoded><![CDATA[<p>Sorry, but I don&#8217;t really understand this part of the tutorials.<br />
What I&#8217;m guessing is that:</p>
<pre>
long lVar;
</pre>
<p>is the same as:</p>
<pre>
typedef long LongChars;
LongChars lVar;
</pre>
<p>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CSESTUDENT</title>
		<link>http://www.learncpp.com/cpp-tutorial/46-typedefs/comment-page-1/#comment-62263</link>
		<dc:creator>CSESTUDENT</dc:creator>
		<pubDate>Thu, 11 Jun 2009 11:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/46-typedefs/#comment-62263</guid>
		<description>Ok I wrote a program like this to calculate distance in km and I used DistanceCovered as alias for the type double:

&lt;pre&gt; #include &lt;iostream&gt;
typedef double DistanceCovered;

DistanceCovered InKilomtres()
{
    using namespace std;
    float speed;
    cout &lt;&lt; &quot;Please enter the speed in km/hr:&quot; &lt;&lt; endl;
    cin &gt;&gt; speed;
    float time;
    cout &lt;&lt; &quot;Please enter the time taken in hours:&quot; &lt;&lt; endl;
    cin &gt;&gt; time;
    return speed * time;
}
&lt;/pre&gt;

It is returning me something like this when I run it in the g++ compiler:
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start&#039;:
/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main&#039;

I&#039;m sure something is wrong with my code but I can&#039;tfind what!</description>
		<content:encoded><![CDATA[<p>Ok I wrote a program like this to calculate distance in km and I used DistanceCovered as alias for the type double:</p>
<pre> #include &lt;iostream&gt;
typedef double DistanceCovered;

DistanceCovered InKilomtres()
{
    using namespace std;
    float speed;
    cout &lt;&lt; &quot;Please enter the speed in km/hr:&quot; &lt;&lt; endl;
    cin &gt;&gt; speed;
    float time;
    cout &lt;&lt; &quot;Please enter the time taken in hours:&quot; &lt;&lt; endl;
    cin &gt;&gt; time;
    return speed * time;
}
</pre>
<p>It is returning me something like this when I run it in the g++ compiler:<br />
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start&#8217;:<br />
/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main&#8217;</p>
<p>I&#8217;m sure something is wrong with my code but I can&#8217;tfind what!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

