[fpc-devel] new features and facilities

Dmitry Boyarintsev skalogryz.lists at gmail.com
Fri Oct 9 20:45:26 CEST 2015


On Fri, Oct 9, 2015 at 2:30 PM, Michael Van Canneyt <michael at freepascal.org>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151009/267dfc39/attachment.html>


More information about the fpc-devel mailing list