hah!! without you we may have still been going on about my passing of arrays and other things that had nothing to do with my stupid mistake of not converting my ints to strings before += them to a string.
For that i thankyou. I am still beginning in c++ and i feel that i do not have the authority to tell someone that they are wrong and have them believe me.
And again thanks a bunch Albatross i might have never seen that at all if it were not for you. I would have ended up aligning to the left and forgetting about centering.
For God's sake, Albatross. You seriously need to STFU. This is nowhere near what I'd call a minor mistake. You're one step from doing something utterly retarded.
1) might compile without error or warning
2) would produce a potentially hard to find runtime bug
I'm just saying....
Maybe this would be better suited as a post in the other thread as an illustration of a reason to avoid evil practices. And that no matter who you are, you'll always occasionally mess up.
I don't think this counts as messing up.
If it was something like forgetting to delete a pointer, or a typo, that's one thing. It happens to the best of us.
This is plain ignorance of very, very, basic syntax and semantics. I wouldn't otherwise make a big deal. And I certainly wouldn't make a big deal if he wasn't giving advice.
Helios..... stop flaming. NOW. Compiling &somearrayname[] would have given an error, and it would have come to light. Quickly. As for using = in a poor context, okay, that was a genuine mistake. Fine, but m4ster r0shi showed me where I went wrong. I did some reading, and admitted I was wrong.
Today was a bad day for me, I had a large number of social conflicts that I had to resolve. Details refused.
Also, it's not often I make larger mistakes, again, today was a bad day for me. You just say STFU without considering the context. How many such mistakes have I made that would cause very hard to find bugs? One. Okay. Any more? Again, calm down.
@Disch
Read carefully. I said when I keep a small log. At least you're trying to think through it without saying STFU.
-Albatross
P.S.- You are not to PM me helios. You have anger management issues and need to calm down. I admitted I was wrong. GTF over it.
Please don't misunderstand me. "Flaming" and "protecting readers from bad advice" are not the same.
I told you (http://www.cplusplus.com/forum/general/23780/#msg124986 ) to learn the syntax before posting. Did you go check on a book what I was saying? No. Instead you tried to prove a point with invalid code that was just wrong enough to make you think you were right.
I'm not telling you to shut up because I want to create drama. I'm telling you to shut up because I seriously think you'll do more harm than good.
The fact that you lik- I'm sorry. LOVE dangerous constructs doesn't, either. You want to use void * as the only type, as you cast function pointers to data pointers, use macros to generate code, and just generally abuse the language for no good reason? Be my guest. Just don't go around telling people they're better solutions.
While I'm at it, I'll reply to something else you've said. I would have replied instantly, but I didn't want to go off-topic:
If you expect to get assistance from anyone other than myself on these forums, you will have to use "good" code. Sorry, but that's the way it is.
Yes, because if the programmer chose to ignore common sense and do it the hard way when there were easier solutions, he loses the right to ask for help when something breaks. It's the price one pays for hubris.
At least now I can see that there is some rational thought behind what appeared to be irrational. Why didn't you post all of that in the first place?!? So much could have been avoided...
I don't take kindly to people telling me to shut up, as I take it you don't take well to people who make serious mistakes for any reason helping others, for fear that they will cause damage. If you want to convince me of something (anything), post a link to a reputable site (the documentation and reference on this site and MSDN's documents count), and tell me where to look. Then, if the site is indeed reputable, I'll readily change my views and submit a correction. Saying "shut up" gets me to ignore whoever says it. Always, regardless of the content that precedes or follows it. That's a general rule for pretty much everyone: don't tell them to shut up for fear of being ignored.
Nice word, "hubris".
As for me doing more harm than good... rest assured that this was indeed a bad day. Usually my solutions on poor days are contorted rather than destructive. This was one of my worse days.
As for my love of "evil" constructs... eh, there's a lot of useful functionality in those. We just need to learn to use them properly. I'll try to avoid encouraging their use, as I recognize that they are indeed easy to abuse.
And... do try to relax. This is a forum, not an episode of American Chopper. ;)
Gee, I need to relax a bit myself...
You don't need the empty do-while construct. Just use braces. They will introduce a new scope:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
int main()
{
int i = 8;
{
int i = 4;
std::cout << "scoped i = " << i << std::endl;
}
std::cout << "i = " << i << std::endl;
return 0;
}
That only makes sense if you're going to break and need to always execute some code at the bottom.
1 2 3 4 5 6 7 8 9 10 11
do{
//resource allocations
if (!fallible_operation())
break;
if (!another_fallible_operation())
break;
if (!yet_another_fallible_operation())
break;
//...
}while (0);
//some clean up code