Compile-time calculation: Difference between revisions
Content added Content deleted
m (→{{header|C sharp}}: Removed extra newline) |
(Merge omitted languages at bottom and add Processing) |
||
Line 123: | Line 123: | ||
In both cases, the identifier <code>factorial10</code> is given the value 3628800 without any runtime calculations, although in many (or perhaps most) BASICs the first one is handled similarly to C's <code>#define</code>: if it isn't used elsewhere in the code, it doesn't appear at all in the final executable. |
In both cases, the identifier <code>factorial10</code> is given the value 3628800 without any runtime calculations, although in many (or perhaps most) BASICs the first one is handled similarly to C's <code>#define</code>: if it isn't used elsewhere in the code, it doesn't appear at all in the final executable. |
||
⚫ | |||
=={{header|C}}== |
=={{header|C}}== |
||
Line 1,390: | Line 1,389: | ||
{{omit from|AutoHotkey|AutoHotkey is an interpreted language - the 'compiler' (separate from the interpreter) just bundles the interpreter and the code inside an EXE, so this sort of thing isn't possible}} |
{{omit from|AutoHotkey|AutoHotkey is an interpreted language - the 'compiler' (separate from the interpreter) just bundles the interpreter and the code inside an EXE, so this sort of thing isn't possible}} |
||
{{omit from|AWK}} |
{{omit from|AWK}} |
||
⚫ | |||
{{omit from|Bc}} |
{{omit from|Bc}} |
||
{{omit from|Brlcad}} |
{{omit from|Brlcad}} |
||
Line 1,403: | Line 1,403: | ||
{{omit from|Openscad}} |
{{omit from|Openscad}} |
||
{{omit from|PARI/GP}} |
{{omit from|PARI/GP}} |
||
{{omit from|Processing}} |
|||
{{omit from|Python}} |
{{omit from|Python}} |
||
{{omit from|Ruby|Ruby has BEGIN { ... } blocks like Perl, but Ruby runs them at run time, not compile time. The compiler cannot fold constant expressions like 10 * 9, because these call methods like Fixnum#*, and Ruby binds methods at run time. Classes are open; the program might redefine Fixnum#* at run time.}} |
{{omit from|Ruby|Ruby has BEGIN { ... } blocks like Perl, but Ruby runs them at run time, not compile time. The compiler cannot fold constant expressions like 10 * 9, because these call methods like Fixnum#*, and Ruby binds methods at run time. Classes are open; the program might redefine Fixnum#* at run time.}} |