|
Rob, I think the problem is that you are assuming human beings are rational/reasonable.
Where I am currently, I have to fill out a form and get authorization to fix a simple memory leak. The code base is several million lines of C++, suffering from 20 years of technical debt. Since I already have a reputation for being "too critical about code quality" which causes my input to get knocked down a level or two, I have to bite my tongue a lot.
It's a grand learning experience, but I'll be glad when I figure out what the lesson is!
|
|
|
|
|
The lesson : Never start a fight in the Hall of Shame 
|
|
|
|
|
The "answer" person's assumptions doesn't seem to match with what you have in your message.
Using & is different than using && and the results could be different, depending on what you are comparing. Since both return either true of false, there will not be a difference in the result. (The only difference is how the result is achieved.)
In C and C++, you can "AND items that are not boolean as:
int i, j;
i = 1;
j = 2;
if (i and j) --> result is false (bitwise AND: 1 & 2 yields 0 or false).
if (i and j) --> result is true (logical AND: 1 && 2 yields non-zero or true).
Hope this helps.
|
|
|
|
|
I like this:
#define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers

|
|
|
|
|
lol. By the way, you look like Adam Levine[^] of Maroon 5.
Ignorance of the ability brings disability.
|
|
|
|
|
Thanks. Hope it was a compliment;)
|
|
|
|
|
Of course it is.
Ignorance of the ability brings disability.
|
|
|
|
|
|
P1l19r1m wrote: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers
Shouldn't that just be #define TRUE (rand() > 0.1) ?
I guess I haven't used c++ in a while, but what happens when you use a circular define like that?
|
|
|
|
|
can we do that ??
i will put this in my mate's code 
|
|
|
|
|
You should do it!!! 
|
|
|
|
|
that's pure evil hopefully, there is no switch statement using this constant...
|
|
|
|
|
I've made some kind of mistake "Copypasting" is evil . As MSDN ( http://msdn.microsoft.com/en-us/library/398ax69y.aspx ) claims, rand() function returns a pseudorandom integer in the range 0 to RAND_MAX (32767). So, the preferable way is to use the following "working code":
#define REALLYTRUE 1
#define REALLYFALSE 0
#define TRUE (rand() > (32762/2) ? REALLYTRUE : REALLYFALSE) // happy debugging losers
P.S. If to compile this code:
#define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers
we will have an error like:
c:\temp\win32\randex\randex.cpp(19) : error C2065: 'TRUE' : undeclared identifier
But using the new version of code it will be "all right" 
|
|
|
|
|
Actually I liked the original version better as it will work in 32766 out of 32767 cases. Now try to reproduce that odd error! 
|
|
|
|
|
da(14) = i + 1
I have absolutely no idea what it means, but I think it will require that my mind bend.
EDIT: Found this in the same codebase (keep in mind, it's VB.NET):
EDIT 2: Aside from the function names (I replaced sensitive info with "XXX"), I changed nothing:
#Region "Functions to write after main functions"
Public Function GetXXXByXXX(ByVal MyStrin As String) As System.Array
Dim myEmpty As System.Array = Nothing
Return myEmpty
End Function
Public Function GetXXXByXXX(ByVal MyStrin As String) As System.Array
Dim myEmpty As System.Array = Nothing
Return myEmpty
End Function
Public Function getXXX(ByVal MyStrin As String) As System.Array
Dim myEmpty As System.Array = Nothing
Return myEmpty
End Function
#End Region
|
|
|
|
|
Jeeez... don't you recognize art when you see it?
'pleaswe make sure that there is no empty
'we can add even more informations
I like it
(yes|no|maybe)*
|
|
|
|
|
AspDotNetDev wrote: I changed nothing
If you changed Nothing then what did those Functions Return before you changed it?
It's an OO world.
|
|
|
|
|
AspDotNetDev wrote: I changed nothing
one cannot change nothing, it is a very stubborn constant, and that is what makes it so popular.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I suppose you can't break anything if you don't change anything or do anything. Sounds like JSL to me.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
This little gem comes courtesy of Q&A:
If TextBox9.Text > TextBox8.Text Then
GoTo bob
Else : TextBox9.Text = TextBox8.Text
End If
Bob: Lovely, no?
Not only that, but he wanted to know why it didn't put the largest number in TextBox9 when TextBox9 had "999" and TextBox8 had "1000".
Sometimes, I get the feeling we should ask who these people are learning from, and have a "hall of shame" just for them...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
OriginalGriff wrote: GoTo bob
He came to the right place 
|
|
|
|
|
It's about the only thing he did do right!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I hope he does not read this. Poor guy came here asking for help, but instead he gets flamed in the hall of shame.
Of course it is something to be ashamed of
OriginalGriff wrote: we should ask who these people are learning from
Judging from the code I think this guy's mentor is called Bob
It's an OO world.
|
|
|
|
|
It’s really bad when they don't get even the most basic things. I sincerely hope this was from a beginning student, not someone with a degree in Computer Science.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
In reality, I have seen people with a masters degree in Computer Science writing this kind of code.
|
|
|
|