Unary negation of Cardinal type
In the past, Delphi handled unary negation of Cardinal type numbers using 32 bit operations, which could lead to some odd results. Here is an example of code which uses unary negation:
var
c: Cardinal;
i: Int64;
begin
c := 4294967294;
i := -c;
WriteLn(i);
end;
In previous versions of Delphi, the value of i displayed would be 2. This is obviously incorrect behavior for this case. In Delphi 6, the unary negation is handled after promoting the Cardinal type to a 64 bit signed type, so the final value of i displayed is -4294967294.
It is possible that existing code may rely on the incorrect behavior of unary negation. Delphi users should be aware of this new behavior. It may be worth your time to check your code for instances of unary negation of Cardinal variables, and make sure that your application responds to the new behavior appropriately.
ËÄ£® µ¥ÔªDsgnIntf¸ÄÃû¼°Ïà¹Ø±ä»¯
¹¤³ÌÖжÔÓÚDsgnIntfµÄÒýÓã¬ÐèÒª¸üе½Ò»¸öеÄÃû×Ö£ºDesignIntf¡£¿ÉÄÜ»¹µÃ¼ÓÉÏDesignEditors£¬VCLEditors ºÍRTLConsts µ½ÄãµÄÒýÓÃÁбíÖС£²¢ÇÒÄ㻹µÃ½«designide¼ÓÈëµ½ÄãµÄPackageµÄRequiresµÄÁбíÖС£¶Ô
ÎÄÕÂÕûÀí£ºÎ÷²¿ÊýÂë--רҵÌṩÓòÃû×¢²á¡¢ÐéÄâÖ÷»ú·þÎñ
http://www.west263.com
ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúÒª×ªÔØ±¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!




