I,ve installed the Compiler and I can,t get even the simplest code to compile properely.
Anyone know where the fix for this bug is?
Or is it a limit of the demonstration version?
void main(void) { cout << "Hello world!"; }
what is it the compileer you installled?
keil c????
if you be answer keil c then code you give is bad and not compiler
you code is c++ but compile is c
c not thinking about cout like this you be not good and give errror
Can someone answer my question in English please!
"Doesn't seem to be much analysis going on there."
There is obviously sufficient analysis going on to allow it to omit a load of stuff if the program uses no floating point.
Presumably, if the program contains floating point and uses printf, the compiler cannot safely assume that there aren't any dynamically-created floating-point formats - so it just has to include them, just in case...
"There is obviously sufficient analysis going on to allow it to omit a load of stuff if the program uses no floating point."
From previous experience of Microsoft compiler technologies, I would say that it is not so much analyzing that the stuff can be omitted but rather that they should not be included.
Specifically - When floating point is required in a module, it makes reference(s) to any external functions that are required for the compiler chosen task.
At link time these external references would normally pull in the libraries that satisfy the external references.
So - It is not normally the formatting string of the printf that is interpreted by the compiler to determine whether the libraries that are included, but rather the fact that a floating point access is somewhere in the project.
Remember people, C is even more limited!
Just curious, but how is C more limited than C++?
That's like saying that assembly is more limited than C. Or, that the Russian language is more limited than German.
Jon
Yes. But that doesn't require, or imply, any analysis of the printf() calls themselves.
Presumably, if the program contains floating point and uses printf, the compiler cannot safely assume that there aren't any dynamically-created floating-point formats - so it just has to include them, just in case.
Indeed.
I want to use C++ because I know C++.
Sure, but be honest and say "I have no idea of anything else, if C++ is right for this job or not does not matter"
NOW DO ANSWER have you ever done ANY small embeeded before, we all know that the answer is 'no' but it would be nice to hear it from you.
Erik
In this instance, dismissing C++ out of academic principal I would say is narrow minded. NOBODY has "dismissed C++ out of academic principal" many have "dismissed C++ out of knowledge of the architecture of the '51"
The problem you are going to run into if you use the Ceibo + Keil and you reply
void main(void) { printf("Hello world\n"); while(1); }
where does the Ceibo C++ come in, in the above mr smokied sardine
void main(void) { printf("Hello world\n");
while(1); }
Oh dear, here we go again.
I quoted two sentences as follows:
As I have said before: The problem you are going to run into if you use the Ceibo + Keil combination is that the evaluation version of Keil C51 only allows a code size of 4 kB. Any complex string formatting function (this includes printf and cout) will easily need upwards of 10 kB code space.
You snipped this down to half a sentence:
The problem you are going to run into if you use the Ceibo + Keil
Thereby removing all the content I was actually replying to.
You then quoted part of my response, this time snipping out all the text that gave meaning to the code snippet.
Go back and read my post again. If you still do not understand it let me know and I will explain it to you in whatever level of detail is necessary.
I do not give a hoot about your post, the subject of this thread is NOT that printf works in C, which we all know, but C++ on the '51.
FYI, at the start of the thread I was (as I admitted) not aware of the nuances.
The fact that you still call the difference between two separate programming languages a "nuance" is rather strong evidence that you're still just as unaware.
Erik,
I think in this case you really have missed Jack's point. He was showing the m51 file to indicate the using printf() in Keil didn't increase the code by 10kB, but rather by 1kBish which was an order-of-magnitude less "badness" than the original statement. It had nothing to do with C++, but was just continuing illustration of what he sees as bad in the responses on this forum -- namely that sometimes the estimates people provide from experience can be exaggerated and overly-emphatic.
Also, just as a point of reference for your future usage: The name he's chosen (Jack Sprat) doesn't have anything to do with sardines. It's from an old nursery-rhyme (though I don't know it's origin) that begins like this: "Jack Sprat could eat no fat. His wife could eat no lean."
-Jay Daniel
Also, just as a point of reference for your future usage: The name he's chosen (Jack Sprat) doesn't have anything to do with sardines.
I know that, but sardines are canned :)
"[Jack Sprat] was showing the m51 file to indicate the using printf() in Keil didn't increase the code by 10kB, but rather by 1kBish"
But did it show that?
It showed that the size of ?PR?PRINTF?PRINTF is 1K-ish, but it doesn't consider what other stuff may also get pulled-in as a result of having printf that wouldn't other wise have been included.
I haven't had the time for a detailed look at the map file, but the summary line from building a simple "Hello, world" example as shown indicates that the total CODE space usage is on the order of 2K...
It probably also varies with the Memory Model chosen...
So: still not 10K, but it certainly does show that a simple printf can easily use up virtually the whole CODE size limitation of the Evaluation version...!
"Just curious, but how is C more limited than C++?"
C++ is (basically) a superset of C
Embedded C++ is (basically) a subset of C++
And Embedded C++ is (basically) a subset of C++
So, expressed in terms of facilities:
C < Embedded C++ < C++
I said it is more limited purely because it is considered to be lower level, less abstract etc
So it could be extended to the expression:
Assembler < C < Embedded C++ < C++
The extrapolation to "Russian is more limited than German" is clearly wrong.
But everyone knows that Esperanto is superior to all others ;)
Just to correct my last post before I get abuse:
And Embedded C++ is (basically) a superset of C
You started this thread because you didn't understand that a C compiler cannot compile C++ source code - you even called this a "bug"
The point in mentioning that Embedded C++ doesn't support everything in "full" C++ was just to save you making the same mistake if you try to compile "full" C++ source code with an Embedded C++ compiler.
I may have started the thread thinking there was a bug.
Since then I've been reading manuals and scanning web sites.
I've been busy and think I've learnt a lot in a short time.
I now know more about the various programming languages and (contrary to the apparent wish of some posters to this thread) am now working on a project with confidence that it will do what the contract requires.
For example, I am already communicating with the display and showing text. Moreover, I am using classes.
I hope that I will continue to learn and as a consequence I can then make and provide balanced opinions in the future.
So, what tool did you buy or are using the demo version of?
"I may have started the thread thinking there was a bug."
You certainly did! And look how stubbornly and vehemently you attacked those who tried to explain to you why it is not a bug, but it perfectly normal and expected behaviour!
"I now know more about the various programming languages"
Good. Now that you understand, look back at your original dozen posts or so - look how you responded to the people who tried to explain this to you. Is it surprising that you got their backs up?
Is it surprising that you got their backs up?
Hmmmm. I might have upset one or two. But WTF. That's life.
More interesting than that is the evidence of bickering between respondents on this thread (and others).
At the moment I'm considering both the IAR and Ceibo options.
Currently the limitations of the demonstration versions (of both) are sufficient high to allow me to do the basics.
"More interesting than that is the evidence of bickering between respondents on this thread"
I think if you go to any forum and find any thread that tries to compare different products, languages, styles, or whatever you'll end up with some of that...!
You're probably right with that.
But what I've witnessed, in the short time I've been here, is that there are one or two people on this forum who seem to go from thread to thread trying to win points over one another.
I will mention no names. You will probably know who I'm talking about!
And I got comments about my attitude!
Which one generates the smallest code, and what processor are you building for?
View all questions in Keil forum