On Fri, Oct 9, 2015 at 2:30 PM, Michael Van Canneyt <[email protected]>
wrote:

I'm not sure this kind of semantics is possible with a compiler intrinsic...
> But if it is: In that case the IfThen or IIF() or somesuch has my absolute
> top preference, followed by ternary. (and the If .. then expression should
> be blasted to hell ;) )
>

Here's an example:

uses sysutils;
var
  a,b : integer;
begin
  a:=1;
  b:=5;
  assert(a=0, 'error: '+intTostr(b));
end.

compiled with (2.6.4)  fpc -al -Sa testassert.pas

Looking at the assembler code, a=0 is evaluated first.
If it's true, the code is passed to the next line after assert, w/o
evaluating 'error '+intToStr(b).

Looks like a good example of conditional intrinsic supported by compiler to
me.

thanks,
Dmitry
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to