|
At the Company i am working in the Intellicence gave me These two methods.
Microcernel.Create<iprinter>().
1. PrintLabel()
2. PrintLable()
Both methods contained the same oneliner.
this._Label();
|
|
|
|
|
I'm not sure, but I've always thought it would be funny to leave this in some code and see people's faces:
if(10 != 10){
abort();
}
=====
\ | /
\|/
|
|-----|
| |
|_ |
_) | /
_) __/_
_) ____
| /|
| / |
| |
|-----|
|
=====
===
=
|
|
|
|
|
You need to combine that with an adapted vague comment:
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
I've seen that in older Fortran programs on compilers for systems that didn't have comparison against constants in their assembly language. They saved zero in a particular location and all comparisons were done against that location. Occasionally, someone would unknowingly pass 0 into a routine in the parameter position where the value was changed by the routine. That is when zero stopped becoming zero and was something completely different. It read something like
if ((0+1) .ne. 1) call abend
|
|
|
|
|
This variant is better for perplexing beginners:
if ( 010 == 10 || 07 != 7) {
abort();
}
(The test is false [ 010 is not equal to 10, but 07 is equal to 7 ] in most C derived languages)
|
|
|
|
|
I worked on a system where the Fortran compiler generated constants in memory locations. All subroutine calls used pass by reference, so it was very easy for a constant to get changed. And very difficult to debug with the tools available in that day and age.
|
|
|
|
|
Prime OS had that, as well as GEC (IIRC)
It made for some "interesting" debugging the first couple of times it happened, but then you leant not to trust constants!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Mine was a comment left by a former employee
"This is where the magic happens, Im a genius and it has nothing to do with Ducks!"
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Where 1=1
I mean that is obvious..
|
|
|
|
|
That's a good point to start complex WHERE clauses. Just add all other constraints with an AND X=Y . You do not need to worry if the statement is the first statement (no AND required) or not (AND required).
|
|
|
|
|
That's specially useful when you need to constantly comment in and out some of the conditions to find the right records.
Without that you'd have to worry to every time replace the AND for a WHERE and vice-versa.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Fabio Franco wrote: That's specially useful when you need to constantly comment in and out some of
the conditions to find the right records. Without that you'd have
to worry to every time replace the AND for a WHERE and vice-versa.
For that, I use TRUE , e.g. in SQL:
WHERE TRUE
AND X=Y
AND A=B
You can then comment in / out the real conditions without any worries about whether a leading AND is needed or not or even if any conditions remain. e.g.
WhereClause = "WHERE TRUE "
& ( test1wanted ? "AND X=Y " : "" )
& ( test2wanted ? "AND A=B " : "" );
|
|
|
|
|
Same thing, except "1=1" is only three characters long
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
My apologies! I had misread your previous comment.
|
|
|
|
|
No need to
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
As a variation on that, you could do something like this:
if ('l' == '1')
{
Abort();
}
Just to play with people who would use fonts that don't distinguish the two well...
|
|
|
|
|
|
I have seen that code in a VB6 app and it was a convenient way to get an empty but initialized (containing columns you were interested in) RecordSet from the database that you could then populate with data and save.
|
|
|
|
|
Just make sure they do not come up with PrintLibel() and this._Libel.
|
|
|
|
|
I frequently use
select * from tbl where 1 = 2
when I'm trying to figure out the columns in a table.
|
|
|
|
|
My favorite that I have seen is this...
if variable < 24 And variable > 26 then
end if
|
|
|
|
|
Ah, variable is surely of type MagnitudeNumber, yes? With a value of -50? It is both less than 24 (because it's negative) and its magnitude is greater than 26.
The comparison operator obviously checks both the signed and unsigned number, and returns true if either satisfy the condition.
|
|
|
|
|
Uhhhh... sure!
Just kidding. The programmer at the time just probably forgot that they checked the same variable twice. Maybe it was supposed to be another variable. I have no clue what the intention was, but its still active in the program. I don't have the heart to comment it out because of how funny the goof is.
|
|
|
|
|
int main (){
long variable = -1;
long var24 = 24;
unsigned long var26 = 26;
if( variable < var24 && (variable > var26)){
printf("%ld, is a magic number, %lu, %ld, %ld", variable, variable, var24, var26);
}
return 0;
}
I was just wondering if this could come up somewhere in the code and still be funny.
-JD
|
|
|
|
|
it could be a 'typo' for an Or
|
|
|
|