Re: [fpc-devel] Program too long ?
Bernd Oppolzer wrote: Jonas Maebe schrieb: On 14/01/16 17:45, Mathias wrote: The code is machine generated. I wanted to test which compiler is faster, the. Of FPC or C ++ C ++ could compile the code without errors. Whether or not it can be compiled is unrelated to the language of course, but to the compiler. We indeed only develop FPC for use with procedures that don't have an extreme size, because that way the compiler uses less memory and is faster. Since such massive routines are often indeed only present in case of machine-generated code, and since in that case you can usually easily adapt your generation to split up the code in multiple routines, there's not much incentive to change this (other than being able to say "yes, we can handle this"). Jonas Some history: The original Pascal compiler (Wirth in the 1970s) also had such an error message "procedure too long"; this is a well known issue for almost all compiled languages, and such limits hit you most of the time much earlier than physical limits or storage limits. I came across some interesting stuff relating to the history of GCC. Apparently Stallman started off with a Pascal derivative ("Pastel"), but various things that the compiler did at a syntactic level (if I'm interpreting it correctly, roughly comparable with generics) meant that it had to be able to hold the entire parse tree in RAM before generating code... which exceeded the capabilities of most computers available at the time. http://www.webcitation.org/6N4WnuuZk -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Add {$I %DATETIME%}
Hello, I'm proposing addition of {$I %DATETIME%} directive. A trivial patch is attached. The following will be possible: const T = {$I %DATETIME%}; begin WriteLn(DateTimeToStr(T)); end. Benefits of this directive: 1) Access to build date/time in native TDateTime format. Existing {$I %DATE%} and {$I %TIME%} are inserted as strings in predefined format, parsing is required to extract date/time components or to reformat it. 2) Atomic access to build date/time. Use of {$I %DATE%} and {$I %TIME%} can have undesired effect if {$I %DATE%} is executed at 2016-01-15 23:59:59.999 and 1 ms later {$I %TIME%} is executed at 2016-01-16 00:00:00.000. Resulting combination of two directive is 2016-01-15 00:00:00, a day out of date. 3) Search and replace of build date/time is no longer a trivial text editor operation. The following ticket can then be resolved: http://bugs.freepascal.org/view.php?id=26472 Denis Index: compiler/globals.pas === --- compiler/globals.pas(revision 32893) +++ compiler/globals.pas(working copy) @@ -509,6 +509,7 @@ function getdatestr:string; function gettimestr:string; +function getdatetimerawstr:string; function filetimestring( t : longint) : string; function getrealtime : real; @@ -770,6 +771,10 @@ getdatestr:=L0(st.Year)+'/'+L0(st.Month)+'/'+L0(st.Day); end; + function getdatetimerawstr:string; + begin + getdatetimerawstr := FloatToStr(Now); + end; function filetimestring( t : longint) : string; { Index: compiler/scanner.pas === --- compiler/scanner.pas(revision 32893) +++ compiler/scanner.pas(working copy) @@ -2427,6 +2427,11 @@ hs:=gettimestr; 'DATE': hs:=getdatestr; + 'DATETIME': + begin + hs:=getdatetimerawstr; + macroIsString:=false; + end; 'FILE': hs:=current_module.sourcefiles.get_file_name(current_filepos.fileindex); 'LINE': ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel