News for hackers. Stuff that matters.
Re:What If I Don't Actually Like My Users? (2008) by ArkyBeagle on Friday June 03, 2016 @08:14AM (#11829821)
When you get access to a time machine, go back in time and have this argument with the poor grad student who committed this sin :)

In assembler, comparisons generally have a result of zero when things are the same because hardware works that way. If the difference between two voltages is zero, they "null" and are the same.

In a pidgin, non-real assembler I'm making up:

MOV AX,A_VARIABLE

MOV BX,B_VARIABLE

CMP AX,BX ;; or maybe AND AX,BX or XOR AX,BX because flags

JNE THEY_ARE_NOT_EQUAL

JMP THEY_ARE_EQUAL

...

THEY_ARE_EQUAL:

...

THEY_ARE_NOT_EQUAL:

In 'C' if I am really concerned about this, I will:

const bool TheThingMatches = (strcmp(a,b)==0);

Edit: It ate my line breaks.

There are no comments on this comment yet.