Delphi: xor vs <> para booleanos
-
26-10-2019 - |
Pregunta
¿Hay alguna diferencia entre:
procedure InequalityMsg(ABool1, ABool2 : Boolean);
begin
if ABool1 <> ABool2 then
ShowMessage('Yeah, they''re not the same');
end;
y
procedure InequalityMsg(ABool1, ABool2 : Boolean);
begin
if ABool1 XOR ABool2 then
ShowMessage('Yeah, they''re not the same');
end;
Solución
No, son exactamente iguales. (Bueno, el código generado puede diferir, pero el comportamiento nunca mostrará ninguna diferencia. Y, según el rendimiento, esta pregunta es muy poco importante).
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow