Re: [fpc-pascal] IntToStr implementation
Michael Van Canneyt via fpc-pascal wrote: More accurately, I meant: you cannot write a function declaration to handle that syntax. It is true that a regular (non-built-in) procedure/function with that syntax can not be declared. Some more strange ducks - Exit allowing Program as parameter (UCSD-Pasca) - Scan allowing a partial-expression as second parameter (UCSD-Pascal) e.g. Scan( -26, =':', S) - SizeOf allowing a type-identifier as parameter etcetera. Regards, Adriaan van Os ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntToStr implementation
On Thu, 18 Jan 2024, Adriaan van Os via fpc-pascal wrote: Also something which cannot be handled by 'standard' syntax. (unless you wish to count generics and implicit specialization as "standard syntax") actual-parameter = expression { ":" expression } . actual-parameter-list = "(" actual-parameter { "," actual-parameter } ")" . The compiler obviously can parse it. More accurately, I meant: you cannot write a function declaration to handle that syntax. procedure Str(O : Integer { what to write here for the :N:M ??? }; var S); Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntToStr implementation
Also something which cannot be handled by 'standard' syntax. (unless you wish to count generics and implicit specialization as "standard syntax") actual-parameter = expression { ":" expression } . actual-parameter-list = "(" actual-parameter { "," actual-parameter } ")" . Regards, Adriaan van Os ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntToStr implementation
On Thu, 18 Jan 2024, Hairy Pixels via fpc-pascal wrote: On Jan 18, 2024, at 1:51 PM, Sven Barth via fpc-pascal wrote: There is no source for Str() in that sense, because Str() is a compiler intrinsic implemented in the compiler's ninl.pas. Well that explains everything now! What is this an intrinsic? I was curious how it was implemented and now I'm even more curious. I asked myself the same question. The reason is it needs to support the same syntax as Write(ln) for padding the output: Str(I:N:M,S); This is not a "standard" syntax and needs to be handled specially by the compiler. Additionally, Str() can be used to convert an enum to a string value: Type TMyEnum = (one,two,three); var M : TMyEnum = one; S : String; begin Str(M,S); end. Also something which cannot be handled by 'standard' syntax. (unless you wish to count generics and implicit specialization as "standard syntax") Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntToStr implementation
> On Jan 18, 2024, at 1:51 PM, Sven Barth via fpc-pascal > wrote: > > There is no source for Str() in that sense, because Str() is a compiler > intrinsic implemented in the compiler's ninl.pas. > Well that explains everything now! What is this an intrinsic? I was curious how it was implemented and now I'm even more curious. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Trash variables (-gt) - Translation
Le 18/01/2024 à 08:57, Michael Van Canneyt via fpc-pascal a écrit : On Thu, 18 Jan 2024, LacaK via fpc-pascal wrote: Hi *, I am translating "Trash variables" (from English to Slovak), but I can not find appropriate words. That's why I want to describe it in more words. Is this correct: "Initialize local variables with random values" ? Or better suggestion? That seems most correct to me. I think it is more something like 'specific pattern values' which are different depending on the number of 't' (extracted from current trunk): ./globals.pas:126: trashintvalues: array[0..nroftrashvalues-1] of int64 = ($,$,$EFEFEFEFEFEFEFEF,0); Thus -gt will use $ pattern, -gtt will use $ pattern, -gtttwill use $EFEFEFEFEFEFEFEF pattern, -g will use $ pattern for 'trashing' of local variables. Pierre ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Trash variables (-gt) - Translation
LacaK via fpc-pascal wrote: Hi *, I am translating "Trash variables" (from English to Slovak), but I can not find appropriate words. That's why I want to describe it in more words. Is this correct: "Initialize local variables with random values" ? Or better suggestion? I once had a bug in a software package, written by me and running at a customer site, that turned out to be caused by an incorrect translation (into Dutch) of a book by Peter Norton. Since then, I refuse to read computer books in another language than the original one . Regards, Adriaan van Os ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal