Sorry I should have been more clear after the colon is line number.
I got that. But what wasn't declared in scope? There's more to the error... what's the rest of it?
I would appreciate the constructive criticism of where it is messy (I tried to follow all the coding style guidelines but I'm still new so...)
A few off the top of my head:
- no comments to explain what anything is doing
- all the variable names are 1 letter long and are totally indescriptive. Many function and class names suffer the same problem.
- Lack of whitespace; everything is crammed onto 1 line or as few lines as possible. Super condensed code like that is very difficult to read.
- Lack of file separation (hello.h is 1230 lines long and contains who knows how many classes which have little to nothing to do with each other. It would make more sense for classes to be separated according to what they do and split across several files to keep it organized)
- Large sections of commented out code intertwined throughout the file
I also spotted some stuff that has undefined behavior (will lead to possible bugs/portability issues). Specifically line 710:
return point_[i].dist(point_[++i < nPoint() ? i : 0]);
Reading and writing a variable (i) in the same line is a big no-no.
I got that. But what wasn't declared in scope? There's more to the error... what's the rest of it?
It says v_ wasn't declared but it was on line 605
A few off the top of my head:
- no comments to explain what anything is doing
Thanks, I'll try to make more of those.
- all the variable names are 1 letter long and are totally indescriptive. Many function and class names suffer the same problem.
It says for local ones used only in a small space and self evidently to be small; http://www.research.att.com/~bs/bs_faq2.html#Hungarian
In more global ones I tried to name ones that do something on what they do and ones that return something on what they return
Lack of whitespace; everything is crammed onto 1 line or as few lines as possible. Super condensed code like that is very difficult to read.
Lack of file separation (hello.h is 1230 lines long and contains who knows how many classes which have little to nothing to do with each other. It would make more sense for classes to be separated according to what they do and split across several files to keep it organized)
Good idea thanks!
Large sections of commented out code intertwined throughout the file
I leave the last way I tried something as a comment in case I want to go back or just see the other ways tried and learn better from mistakes.
I also spotted some stuff that has undefined behavior (will lead to possible bugs/portability issues). Specifically line 710:
Thanks! I thought a ? b : c was just shorthand for if(a)then b else c;
There's sections tabed in 24 times! Seriously if you can understand this then you're a genius I want you on my team.
Sorry, I thought the alignment made it EASIER to understand :/
Here it is without alignment, split into multiple files, etc; http://filebeam.com/52e85f4a106218a0dee629ac31a70523
Doesn't read any easier to me (harder in fact) but hopefully it will be easier to find why v_ is undeclared now? P.S. thanks for the tips.