[fpc-pascal] Proper preprocessor?

Ryan Joseph ryan at thealchemistguild.com
Fri Jun 22 10:12:14 CEST 2018



> On Jun 22, 2018, at 12:24 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> If $Assertions is set to Off the complete Assert() line will be absent from the compiled code.


Good to know thanks.


Here’s an example of something I’ve seen for debugging. I think that was kind of cool you could print types like that and I’m not sure how that would work in Pascal if at all. Maybe some RTTI magic perhaps.

{$define typestr(t):='#t: '+IntToStr(sizeof(#t))}

program macro_test;
uses
	SysUtils;

type
	MyRecord = record
		x, y, z: single;
	end;

begin
	writeln(typestr(MyRecord)); // MyRecord: 12
end.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list