i am facing error C141: syntax error near '}'
my program is given below:
#include<reg51.h> void main ( ) { int x; while (1) { P1 = 0x00 ; for (x=0 ; x<=5000 ; x++) P1 = 0xFF ; for (x=0 ; x<=5000 ; x++) } }
any one can help me how to solve it
Yes we can.
But why can you not use the correct formatting so we get to see a properly intended source code? Didn't you check the information directly above the message input box?
Back to your - very hard to read - code: What should a for loop do if you have nothing for it to do? Can a for loop be totally without statement - what does your C programming book say?
Another thing - what use is it to make 5001 assigns of P1 = 0xFF directly after each other? Exactly how do you think P1 = 0xFF interacts with the for loop?
Back to your - very hard to read - code
Not very nice but you really think it's hard to read? It's virtually a one liner.
You missed the point entirely!
No. I was replying to your rather sloppy description of what matters to a compiler.
"Was all that bitching really justified from that post or was it all from my second post? Remember, the one you asked for."
And if you read my posts - please show where I have bitched. I have given reasons why that pre tag matters even for this small code example.
Per,
And if you read my posts - please show where I have bitched.
I said "Then followed an extraordinary amount of bitching." I did not say the bitching was from you.
There were a small number of sensible responses, but would you deny that a few old regulars jumped on the bandwaggon? You know, those cohorts. Did you read some of the things they said? I see a few of those as not being just wrong, but also being outrageous. Nothing actually being said, just people looking for an excuse to say something, anything really. And some clearly just wanting to belittle.
Now I will not say any more on the matter. Maybe this post will trigger another flurry of outrageous comments. I may read them, to see if anything useful is added, but I'm not going to drawn in by any more 'what do you think about that' traps from you.
"[...] but I'm not going to drawn in by any more 'what do you think about that' traps from you."
So - what traps have I laid? Why you blame me if you get into troubles in a thread?
You worry about threads going down the drain. Still you use colored words like "sloppy", "traps" etc. Why am I suddenly thinking about kettles and black?
Tut-Tut.
That might even have been a valid argument, were it not for the fact that what is shown here was shown on the OP's screen first. That's exactly what the preview-before-post mechanism was created for.
So the OP did see that the formatting was shot, and decided to post it as broken as it was.
Lesson learned: before you blame others, try to get your facts straight.
The op might not of seen what you think chum.
You do not always see the full preview of what your going to post with the preview-before-post mechanism. Just try entering some text, previewing, then entering more text. Now the post button is visible and enabled. So the op could of entered his text, then previewed, then pasted in his code and posted without seeing how bad it looked.
Lesson learned: before you state what you think is a certainty, try to get your facts straight.
what hinders anyone from clicking 'preview' even when not forced to? do you consider 'preview' an annoyance?
Erik
Erik,
I have a really straight forward question. Do you think anyone that makes a mistake should be blasted for making a mistake?
do you consider 'preview' an annoyance?
I don't. Do you think that what I said implied that I do? I just pointed out that the reasoning of Hans-Bernhard Broeker is floored when he insisted that the op did see the formatting when, really, he might not of.
"Do you think anyone that makes a mistake should be blasted for making a mistake?"
Read my first answer in this thread. Was the OP blasted?
Ok, blasted might be an extreme word. But it's a straight forward question. Basically, does he (or you, if you take issue with the question) think people who make mistakes deserve any grace or should they immediately be berated for making a (easy enough) mistake? I'm just trying to make a point that there's a difference between laziness and making a mistake. If you believe that people who make mistakes should be given no grace and should be treated as if they're lazy, fair enough. If you differentiate between the two, that's fine too. I was just curious and just wanted a straight answer.
Well - my post did contain the text:
"But why can you not use the correct formatting so we get to see a properly intended source code? Didn't you check the information directly above the message input box?"
Then I did give the pertinent information to the problem with the code.
So should we not point out the issue with formatting, when the code in question have an error that do relate specifically to scoping rules - something that indentation rules was created to better highlight?
Forget that for now, I think we've beat that horse into the ground. What I'm trying to understand is the perception of how people post here (not you so much, I'm actually more interested in hearing Erik's reply to this one), whether it's read as laziness regardless or if there's any consideration that a person could simply have made a mistake. It's a very, very specific, direct question. It's not difficult to answer. Answer it if you want or ignore it.
Do you think people who make mistakes deserve any grace or should they immediately be berated for making a mistake when posting here, regardless of circumstances of the mistake?
I'm not talking about in context to THIS situation (we've gone over it over and over). I'm talking about in general. Is the possibility of someone making a mistake even a factor in responses or should anyone who makes a mistake be treated as if they're just being lazy?
Heh, on a sidenote, it's pretty amusing that there are now 53 responses to a one line piece of code that was merely missing a semicolon . . . :)
No - I'm pretty sure the code missed two (2) semicolons.
View all questions in Keil forum