Delphi:Xor vs <>布尔人
-
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