[fpc-pascal] Constants in generics
denisgolovan
denisgolovan at yandex.ru
Tue Nov 27 08:51:58 CET 2018
> Here’s my test which seems to be working.
>
> program gc_procs;
>
> generic procedure DoThis<T,const U:string>(msg:string = U);
> begin
> writeln(msg, ' ',sizeof(T), ' ', U);
> end;
>
> begin
> specialize DoThis<integer,'foo'>('hello world’); // prints "hello world 4 foo"
> specialize DoThis<integer,'foo’>; // prints “foo 4 foo"
> end.
Thanks.
That's definitely a nice feature.
--
Regards,
Denis Golovan
More information about the fpc-pascal
mailing list