Pages: 1 [2] 3   Go Down
Author Topic: Label related compiler error  (Read 2671 times)
0 Members and 1 Guest are viewing this topic.
New Jersey
Online Online
Faraday Member
**
Karma: 70
Posts: 3742
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ask someone who will (hopefully) cut to the chase and actually tell me the answer to what I am asking, instead of telling me all the reasons it's so bad to do it.

There's an expectation when posting answers here that they're not just for the benefit of the OP. Other folks will take note of what's written, so you'll always get the reasons why goto is bad recited if you ask about using it, just as most any question about dealing with mains voltage garners a warning about the possible dangers.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 504
Posts: 19095
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This. It's like asking how to clean a loaded gun. If the answer didn't include a lot of warnings, the implication would be that the experts think that is a good thing to do.

OK. Let's try this. Go ahead. Load your code up with impossible to follow goto statements and labels. Then, when you have a problem with it not performing as expected:
Code:
goto someplaceElseForHelp:

Plus what PaulS said.
Logged


UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

actually tell me the answer to what I am asking, instead of telling me all the reasons it's so bad to do it.

It's "as well as", rather than "instead of".

You asked why it didn't work; you've been told. You've also been told that what you were trying to do is not recommended - which is true, however much you may dislike it.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought Nick was joking about asking how to disable the airbags, so I just continued on it.

In the first post I requested an answer to a compiler error, and requested that nobody talk about the downsides of labels and gotos. Well over half the posts have been about something OT from my question, or irrelevant to me finding the answer. I implied right off the bat that labels and gotos are not recommended, which other people reading this thread in the future should have picked up on.

IMO these forums are great for sharing information, and helping people out, but it sure takes from the experience to often have people (seemingly) go out of their way to annoy me, or just troll/spam the thread. I'm not sure how many threads I have started, only to have a majority of the replies be OT from my question(s), or otherwise mostly useless.

I've been within the top three posters on about 4 tech-related forums (each for over a year), since I was about 14 YO, and I can honestly say that the Arduino forums are not a pleasure to use. I go out of my way to avoid these forums, and only post here when I can't find the answer anywhere else, because I know how welcome you make me feel. I really really wish that was not the case smiley-cry

Hopefully next time I post a question here, things will go smoother.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 504
Posts: 19095
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A lot of people say how helpful these forums are, I'm sorry your experience hasn't been as positive.

Look on the bright side, we are trying to help you, not annoy you.

The thing is, and we see this quite often, and today there is another thread like this, the more people ask a really technical question, without in any way relating it to a real-world problem, the more likely we are to find, three pages on, that they have gone about the actual problem (so far a secret) in a way that is ... how shall I put this? ... not optimal.

I remember now, there is another thread about "which is faster: 'while' or 'for' "?

On the face of it, it is a reasonable question, but there is a lot unsaid there. Does it matter? What is being attempted? Maybe the underlying hardware makes the question irrelevant.

Part of the service is not just answering the literal question, but trying to see past it to actually helping you solve the underlying problem.
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, I can understand where you are coming from.

I this case, I was just playing around with labels for testing the logic of a program. I wasn't planning on using them in the end, just in the design process. Meanwhile I ran into an error, and though I'd ask about it.

Is there a way though, that I can ask questions and have people answer them without trying to solve the "less optimal" underlying design? Perhaps some sort of "magical" key word that indicates I'm looking for answers to my questions, but I'm not looking for help with the underlying design, or the pros and cons of the situation (or a discussion about something unrelated to my questions)?
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4349
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that it is inevitable that you will get replies over and above your original question(s) because most require the code to be seen leaving the door open for comments to be made about it.  As Nick said above this is in the interest of people reading the thread who may pick up tips that are unrelated to the original question.  I know that I have.

What does happen sometimes is that the discussion moves away from the original point but you can easily bring it back by posting further questions about your problem and/or revised code incorporating changes made as a result of earlier answers.  On the whole I think that we benefit from OT comments because, after all, they are easy to ignore if we don't want to read them.

There are some subjects, notably goto and the use of Strings (capital S), that provoke replies that some people don't want to hear, but that is the case in every forum on various subjects that I have belonged to.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ask someone who will (hopefully) cut to the chase and actually tell me the answer to what I am asking, instead of telling me all the reasons it's so bad to do it.

There's an expectation when posting answers here that they're not just for the benefit of the OP. Other folks will take note of what's written, so you'll always get the reasons why goto is bad recited if you ask about using it, just as most any question about dealing with mains voltage garners a warning about the possible dangers.

Some people are special. Special people take precedence. Even ones with years in forums who should know better.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 504
Posts: 19095
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps some sort of "magical" key word that indicates I'm looking for answers to my questions, but I'm not looking for help with the underlying design, or the pros and cons of the situation ...

Yes, but that's like asking:

"How do I kill my sister? And I don't want to hear about how killing her is a bad idea, just ... how do I do it?"

Do you not see that this question can't be answered without warning about whether or not it is a good idea?
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 504
Posts: 19095
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

... the Arduino error messages are almost always useless, so I tend to disregard them.

If you hadn't disregarded the error message this whole thread wouldn't have been necessary. So a little humility here wouldn't hurt.

It answered your initial question. It wasn't useless.
Logged


Offline Offline
Faraday Member
**
Karma: 62
Posts: 3080
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd be more convinced by your attitude,  if the error you got had been really strange or obscure.

But it wasn't.  The error message told you exactly where and what the problem was. 

If you had actually read the error message,  you would have solved your problem without having to write
all those weird disclaimers in your first question.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 642
Posts: 50411
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I go out of my way to avoid these forums
Not far enough.

Code:
goto tryHarder:
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Apparently Special People run on Blocking Code.
It blocks them from noticing much less giving a damn about everyone else, the forum exists just for them.

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One reason I disregarded the error, was that it didn't tell me where to put the semi-colon. It just said "expected `;' before '}'". In the original situation, the line number it gave was off by about 25 lines (as is typical with Arduino errors).

Nick, I came right out and said that I tend to dis-regard the errors, implying that this time I made a mistake in doing so. Asking how to kill someone implies you are trying to do something wrong. Asking about a compiler error, or even asking how to use goto does not imply anything more than the programmer is using bad programming practice. There is nothing wrong with using goto. It's a legitimate command, that if mis-used, would probably only mean future debugging troubles.

GoForSmoke, probably 70-90 percent of my forum posts have been to help others, not to ask for help.

As far as I am concerned, this thread should have ended after reply #7. At that point, I had the answer to my question (I was satisfied), and there were several warnings against using goto (everyone else should have been satisfied). What more could one want?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And do you think we could please leave it at that? I'd appreciate it very much if an admin would trim this thread back to (leaving) reply #7.
Logged

Pages: 1 [2] 3   Go Up
Jump to: