Delphi:xor vs <> for booleans
-
26-10-2019 - |
質問
間に違いはありますか:
procedure InequalityMsg(ABool1, ABool2 : Boolean);
begin
if ABool1 <> ABool2 then
ShowMessage('Yeah, they''re not the same');
end;
と
procedure InequalityMsg(ABool1, ABool2 : Boolean);
begin
if ABool1 XOR ABool2 then
ShowMessage('Yeah, they''re not the same');
end;
解決
いいえ、まったく同じです。 (まあ、生成されたコードは異なるかもしれませんが、動作は決して違いを示しません。そして、パフォーマンスが進むにつれて、この質問は非常に重要ではありません。)
所属していません StackOverflow