<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C++</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/19755/c</link><description> 
Anyone tried C++ yet. It seems to be available. I tried the
following. iostream with no extension is available but the source
file won&amp;#39;t open it for some reason. On the last line of output window
it says no C++ support available. 

 
I was just curious</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: C++</title><link>https://community.arm.com/thread/144159?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2006 14:23:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:35abffda-3a37-4629-9fb5-e4c5e1724672</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Drew, Robert. I really appreciate your comments. I am primarily
driven by curiosity. I appear to have a good install now because
Robert confirms getting the same results.&lt;/p&gt;

&lt;p&gt;
One feature of C++ that would have made the last project cleaner
is the C++ feature &amp;quot;overloading functions&amp;quot;.&lt;/p&gt;

&lt;p&gt;
I have just compiled an existing program and it is slightly
smaller, approx 2% using the C++ compiler.&lt;/p&gt;

&lt;p&gt;
Where from here? I will try to become more proficient in C, and to
get a handle on C++, until now I didn&amp;#39;t see the point. But I am
definately impressed by what Robert has indicated what can be done.
Can I do what he did, definately not (read envy!).&lt;/p&gt;

&lt;p&gt;
Maybe I should ask if we can purchase what he has done, it would
sound like a good investment.&lt;/p&gt;

&lt;p&gt;
I do wish COUT would work and perhaps I will try to look into it
but for now I have to be real and concentrate on what gives me a
living which isn&amp;#39;t C programming.&lt;/p&gt;

&lt;p&gt;
It would be nice if there could be a Keil C++ promotion to provide
more examples etc. I really didn&amp;#39;t know that this tool was even
available until I read the compiler pdf.&lt;/p&gt;

&lt;p&gt;
Anyway thanks again!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/141678?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2006 11:00:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:08527cca-40fb-420d-98d6-01af85772b9c</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;d have to agree with Robert that this particular program tells
you nothing about C versus C++, but rather only compares the I/O
libraries.&lt;/p&gt;

&lt;p&gt;
Back in the day, many C++ implementations didn&amp;#39;t have nearly the
refinement in their standard I/O libraries that the C compilers had
put in. Use of &amp;quot;cout&amp;quot; tended to drag in lots of library code that
might not have been directly related. In contrast, many C compilers,
especially embedded ones, will snoop the printf() format strings and
include one of several variant printf() implementations based only on
the features of printf() you actually use. As a result, it wasn&amp;#39;t
uncommon for a C++ &amp;quot;hello world&amp;quot; to be larger than a C &amp;quot;hello
world&amp;quot;.&lt;/p&gt;

&lt;p&gt;
But this observation has nothing to do with the relative benefits
and drawbacks of the languages, nor is it a gauge for what the
compiler will do with your actual code.&lt;/p&gt;

&lt;p&gt;
These days the C++ compilers probably do better thanks to
restructuring their internal standard library implementations, but I
haven&amp;#39;t tried it in a while.&lt;/p&gt;

&lt;p&gt;
One test would be to run your actual code through the C++
compiler. Of course, if it&amp;#39;s really C code, you&amp;#39;ll get pretty much
the same results as from the C compiler. If you rewrite the code to
C++, then you&amp;#39;ve introduced the factor of the skill used to rewrite
the code (presumably not necessarily high when you&amp;#39;re just conducting
this sorts of initial experiments) and whether or not it&amp;#39;s really an
apples-to-apples comparison. It&amp;#39;s a common mistake to throw every C++
feature in the book at such a rewrite, but then the two programs
don&amp;#39;t have the same capabilities. The program that can do dynamic
dispatch or update its target objects while operating has
capabilities a statically-bound version does not, and will also be
larger and slower -- regardless of which language is used for the
version with all the dynamism.&lt;/p&gt;

&lt;p&gt;
My experience has been that C++ is just as efficient as C. And
when you ask for more advanced features (virtual functions, etc), the
implementation there is also about as efficient as you&amp;#39;d roll by
hand. The real questions to ask are:&lt;/p&gt;

&lt;p&gt;
- what benefits will the new language features bring to my
project&lt;/p&gt;

&lt;p&gt;
- do I have the C++ skills to make good use of the new language
(and if not am I committed to acquiring them)&lt;/p&gt;

&lt;p&gt;
I mention the second point because C++ is considerably more subtle
and difficult to use well than is C. An expert C programmer is not an
expert C++ programmer, and that programmer will have to study to
become so. (Some programmers in my experience don&amp;#39;t really accept
this; their ego says they&amp;#39;re experts, and they think their expertise
automatically extends to anything related to computers. The
superficial similarity in the syntax of C and C++ misleads them into
thinking the semantics are also similar.)&lt;/p&gt;

&lt;p&gt;
C++ is powerful, but it also can trip you up if you don&amp;#39;t
understand what it&amp;#39;s doing and why. It expects you to make choices
that other language designers made for you, so you have to understand
both forms of a feature and the tradeoffs involved. C++ is like a
chainsaw: powerful, useful, and if you&amp;#39;re not in control of it it
might jump off the log and lop your toes off.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/138307?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2006 10:26:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:73b31e97-35cd-4958-b3d0-62d4ae3c0158</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
I don&amp;#39;t know if it sould compile, but it does not in my
environment (cout is not defined). I don&amp;#39;t use printf (or sprintf)
because it increases the code size too much. I can&amp;#39;t imagine what an
implementaion of cout might do to code size, nor do I think that
comparing the size of code using cout to printf has any meaning.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/134868?ContentTypeID=1</link><pubDate>Wed, 15 Nov 2006 19:45:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3c7a8ef5-72d3-44ff-ba2c-e72276f2ee13</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Robert, thanks you have already helped, but I need a shade
more!&lt;/p&gt;

&lt;p&gt;
I have been upgrading the Keil over time and I had an idea that
there was a problem even though with C things were fine. trying
anything with C++ gave me lots of errors. Anyway, today I decided to
remove all Keil, clean the registery and re-instal v3.03a.&lt;/p&gt;

&lt;p&gt;
Good news, I can now compile the piece of code you posted. So next
I wanted to go a step further and tried the following code. But I get
one error&lt;/p&gt;

&lt;p&gt;
Text1.cpp(10): error: #20: identifier &amp;quot;cout&amp;quot; is undefined&lt;/p&gt;

&lt;p&gt;
in the project workspace I have Startup.s (copyright c 2005-2006)
and Retarget.C and main.cpp (I am not sure if this is correct)&lt;/p&gt;

&lt;p&gt;
iostream is now found, which didn&amp;#39;t happen before, and the
multitude of error&amp;#39;s have gone away. This is at the end of my day and
I post this hoping that there is something simple wrong. I notice
that iostream seems to pull in every library and header file, I count
about 60 files below iostream in the project workspace.&lt;/p&gt;

&lt;p&gt;
I would like to know if this should compile as is.&lt;/p&gt;

&lt;pre&gt;
//main.cpp
#include &amp;lt;iostream&amp;gt;

class a {
public: int b;
};

main()
{ int x; a c; c.b = 1; x = c.b; c.b = x;
      cout &amp;lt;&amp;lt; &amp;quot;hello C++ world\n&amp;quot;;
      return(0);
}
// end main.cpp
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/123501?ContentTypeID=1</link><pubDate>Wed, 15 Nov 2006 08:28:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1a47a0d1-9074-4ee2-b3d2-952135f6161c</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
I am not really sure how to help.&lt;/p&gt;

&lt;p&gt;
I have created a new project and it by default uses realview,
which is a c++ compiler. I created 1 file, main.cpp as follows (not
very usefull)&lt;/p&gt;

&lt;p&gt;
//main.cpp&lt;/p&gt;

&lt;p&gt;
class a {&lt;br /&gt;
public: int b;&lt;br /&gt;
};&lt;/p&gt;

&lt;p&gt;
main()&lt;br /&gt;
{ int x; a c; c.b = 1; x = c.b; c.b = x;&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
// end main.cpp&lt;/p&gt;

&lt;p&gt;
It compiles fine.&lt;/p&gt;

&lt;p&gt;
What are the error messages that you are getting?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/123507?ContentTypeID=1</link><pubDate>Wed, 15 Nov 2006 04:16:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1c821bdb-0d38-4bb3-a9ba-8b8c2c3a04d4</guid><dc:creator>D S</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;ve started a C++ Project for the STMicro ARM0 STR912.&lt;br /&gt;
All files without (today) the STMicro Library are in C++. It works
very vell.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/112450?ContentTypeID=1</link><pubDate>Tue, 14 Nov 2006 16:41:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0b05dcba-0b9b-4fae-a0d4-6bba01d1215f</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
I tried to use the C++ as is. But got a whole bundle of error
messages which wasn&amp;#39;t very encouraging. Like your engineers I was
also put off by reports of bloated code. I was primarily lead by
curiosity. But I dont understand how you are using the C++ compiler,
and how do you invoke it. You are using the compiler supplied in
BIN30 right? I would appreciate a minimal program to kick me off, to
get a taste of things.&lt;/p&gt;

&lt;p&gt;
This is the second post on C++, as you are the only person to
respond, maybe you are also the only person actually using Keils C++
?!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/98631?ContentTypeID=1</link><pubDate>Tue, 14 Nov 2006 07:35:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fd5cd020-731b-4eaf-be40-009729454d78</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
I doesn&amp;#39;t appear to be a work in progress. We are delivering full
systems using the C++ compiler. I have not yet had the need to use
iostream in any of our systems, so I really cannot comment on that
part (even printf is WAY too large for us to use). This complier has
clearly been around quite a while (as I said, it was the ARM (ARM as
a company not as a processor) compiler that Keil is now using since
ARM (the company) bought out Keil. I do not use the Rouge Wave
libraries, so I cannot comment on that either. We actually converted
a C project to C++ and the engineers where concerned that the code
would &amp;quot;bloat&amp;quot; when we did that. I needed to be very careful in the
conversion so that did not happen.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/74538?ContentTypeID=1</link><pubDate>Tue, 14 Nov 2006 01:01:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0e4d6189-ff5a-4590-a833-275098b7f0df</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Robert,&lt;/p&gt;

&lt;p&gt;
Thank you for the very interesting information. I have not spent
any real time on the Keil C++ yet. I am intrigued to see that Keil
have provided a C++ compiler and Rogue wave C++ library. But as you
see I didn&amp;#39;t get past &amp;quot;hello world&amp;quot; yet, and Keil don&amp;#39;t seem to have
provided any implentation details. Your post has certainly rekindled
my interest. Perhaps this is work in progress at Keil - would love to
know more!&lt;/p&gt;

&lt;p&gt;
Thanks.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: C++</title><link>https://community.arm.com/thread/47195?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2006 08:38:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bb0c695b-fdcf-4d14-95ad-83f388f16301</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
I use the Realview C++ and think it is a great implementation
(This came from ARM and is not Keil&amp;#39;s). I converted a C project to
C++ and the size did not grow at all and even allowed me to shrink a
few items because the algorythm simplified. I converted many items to
templates (task with stacks, message queues) I use constructors so
that my RL-ARM semaphores, mailbox&amp;#39;s and box&amp;#39;s are initialized
without having to call init functions and I use a few simple base
classes with inheritance as well as virtual functions where
nessacary. I have had no issues.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>