Mihail
That's just stupid and asking for trouble
olli
Mm.. In fact, I guess I can declare something on std if I want, in my libarary, right?
adding declarations or definitions to namespace std or any nested namespace is undefined behavior (*) (*) there are a few exceptions though
olli
like std::hash?
yes, this is one of the exceptions
Mihail
adding declarations or definitions to namespace std or any nested namespace is undefined behavior (*) (*) there are a few exceptions though
No matter what the exceptions are, his library definitely isn't one of them and doesn't belong in std
olli
No matter what the exceptions are, his library definitely isn't one of them and doesn't belong in std
I do agree, that's why I added is as asterisk. Not mentioning the exceptions would make the statement wrong though.
Anonymous
https://pastebin.com/FJMN8R9r
Anonymous
Can anyone see an issue with the formatting of my code
BinaryByter
DUDE no need to put empty lines everywhere
Anonymous
functions.cpp: In member function ‘int theGame::gameMechanics()’: functions.cpp:81:2: error: a function-definition is not allowed here before ‘{’ token { ^ functions.cpp:116:6: error: ‘fillInLetters’ was not declared in this scope if(fillInLetters(letter , rapperNames, hideRappersName) == 0 )
olli
I guess yes?!
olli
olli
The formatting is really bad..
olli
why are you mixing spaces and tabs?
Anonymous
functions.cpp: In member function ‘int theGame::gameMechanics()’: functions.cpp:81:2: error: a function-definition is not allowed here before ‘{’ token { ^ functions.cpp:116:6: error: ‘fillInLetters’ was not declared in this scope if(fillInLetters(letter , rapperNames, hideRappersName) == 0 )
Anonymous
Get this compiler error
olli
Yes
that should explain the error, shouldn't it?
BinaryByter
that should explain the error, shouldn't it?
I don't get what you mean 🤔🤔🤔🤔🙄🙄🙄🙄🙃🙃🙃😔😔😔😔😔😔😔😔😔😔😔😔😔😔😔😠😠😠😠😡😡😣😣😣😖😖😖😖😒😒😞😔😔😩😩😩😩😫😟☹️
Mihail
https://pastebin.com/FJMN8R9r
int i; `for(i = 0; i <rapperNames.length(); i++) Can be: for(int i = 0; i <rapperNames.length(); i++)` which is both simpler to write, understand and the variable's lifetime ends right after the for loop ends, which is better opposed to keeping it for the entirety of the scope, unless you need it later of course
Mihail
Also forloopcounter is just too long
Mihail
I'd use i and j, they are used mostly exclusively for the purpose of counter variables
Mat
I'd use i and j, they are used mostly exclusively for the purpose of counter variables
Yeah, one of the few places where a single letter variable is perfectly understandable
Mihail
https://pastebin.com/FJMN8R9r
Also an if with just one statement doesn't even need { } So if(condition) { return 0; } Can be just: if(condition) return 0;
BinaryByter
so its fine ¯\_(ツ)_/¯
BinaryByter
though I generally leave out braces when not needed
Mihail
I'd agree that if (condition) { } vs if(condition) { } is coding style, but adding 3 lines for a return 0; isn't
Mihail
(imo)
BinaryByter
both approaches are valid code
Mihail
They are, but isn't one better in like every way?
Anonymous
Guess readability is the goal
Mihail
Is writing unnecessarily hard to read code coding style?
Anonymous
How do I take an empty char as a input
BinaryByter
but it makes the code more maintainable
Mihail
Empty char?
Mihail
Wdym?
Anonymous
Well it’s a word guessing game that accepts char
Mihail
It can't just be empty
Anonymous
So what if the string has a space
Mihail
Well it has a space
Anonymous
Like “Bizzy Bone”
Mihail
It's not empty
Mihail
You could even have a zero-width space if you want
Anonymous
But the game accepts char input from user
Mihail
But it still wouldn't be empty
Mihail
So what exactly are you trying to achieve?
klimi
You have nice patience
klimi
I would blow up after second message
Anonymous
Mihail
Yeah
BinaryByter
both have upsides and downsides
Mat
One line ifs are worst than two line ones
BinaryByter
not really
BinaryByter
they are faster to parse with the eye
BinaryByter
however, they are harder to change quickly
Mihail
Two line without { } is also nice
Mihail
Tho I prefer one line
Mihail
It's all like: if condition statement
Mihail
It doesn't get more readable for me
Anonymous
Yeah
https://pastebin.com/YQrtWwwG
Anonymous
This is the int main
Anonymous
https://pastebin.com/6EajDJtQ
Anonymous
Header.h
Anonymous
https://pastebin.com/pdLFL8aR