From: csmajohnson <csm...@ho...> - 2003-02-18 14:05:33
|
Martin: Good summary of the messages and context I missed. With the XP list traffic my hotmail drops a lot of messages when the inbox gets full (OT : perhaps time to pay $$$ for extra hotmail storage).I would agree with your assertion. My guess is that the best one could do would be to embed some design by contract support into the function to ensure a valid result. Functions can be written with some really weird side effects such as: pass by value return function foo(x : boolean) : boolean; begin result := not x; end; var y : boolean; begin y := true; y := foo(y); end; or pass by reference return: function foo(var x : boolean) : boolean; begin x := not x; result := not x; end; var y : boolean; begin y := true; y := foo(y); end; These situations can lead to unexpected result depending on if delphi always makes the function assignment at the end. Delphi 2.0 used to GPF on Pass by Value return (optimizer on or not). I haven't tried to write code like this since then and have artfully avoided such constructs like the plague. These situations lead me to suspect that simply clearing AX will not work reliably in all cases, however since I have very little hair to begin with I try to avoid looking at the CPU pain/pane as much as possible. -Mike -----Original Message----- From: dun...@li... [mailto:dun...@li...] On Behalf Of Larsson Martin Sent: Monday, February 17, 2003 9:02 AM To: 'dun...@li...' Subject: RE: [DUnit-interest] Interesting condition when "optimizations" is turned on Mike asked: >Are you suggesting here that you allow the code to compile > with hints <> 0 and warnings <> 0? I'm not suggesting anything of the sort, rather the opposite... :*) This discussion originated with a question from Robert Dunn: > I've noticed that if you don't set the result type of a boolean > function the Check function will not evaluate the condition > correctly. I had a long reply with a lot of fun assembly code. But I ended up suggesting eliminating hints and warnings. That was after a lot of ugly (or fun) assembly, so I won't blame anyone for not reading it. Juancarlo suggested a quickfix by clearing AX. Which won't work, I think. My assumption was that Robert really wanted to *test* if a method actually set it's returnvalue. That is not possible in anything but the simplest do-nothing methods. M. This footnote confirms that this email message has been swept by our anti-virus solution for the presence of known computer viruses. gfh-te-200************************************************************* ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dunit-interest mailing list Dun...@li... https://lists.sourceforge.net/lists/listinfo/dunit-interest |