comparison man/lispref/compile.texi @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents 576fb035e263
children 80d9ab2e9855
comparison
equal deleted inserted replaced
445:34f3776fcf0e 446:1ccc32a20af4
44 * Docs and Compilation:: Dynamic loading of documentation strings. 44 * Docs and Compilation:: Dynamic loading of documentation strings.
45 * Dynamic Loading:: Dynamic loading of individual functions. 45 * Dynamic Loading:: Dynamic loading of individual functions.
46 * Eval During Compile:: Code to be evaluated when you compile. 46 * Eval During Compile:: Code to be evaluated when you compile.
47 * Compiled-Function Objects:: The data type used for byte-compiled functions. 47 * Compiled-Function Objects:: The data type used for byte-compiled functions.
48 * Disassembly:: Disassembling byte-code; how to read byte-code. 48 * Disassembly:: Disassembling byte-code; how to read byte-code.
49 * Different Behavior:: When compiled code gives different results.
49 @end menu 50 @end menu
50 51
51 @node Speed of Byte-Code 52 @node Speed of Byte-Code
52 @section Performance of Byte-Compiled Code 53 @section Performance of Byte-Compiled Code
53 54
782 @result{} nil 783 @result{} nil
783 @end group 784 @end group
784 @end example 785 @end example
785 786
786 787
788 @node Different Behavior
789 @section Different Behavior
790
791 The intent is that compiled byte-code and the corresponding code
792 executed by the Lisp interpreter produce identical results. However,
793 there are some circumstances where the results will differ.
794
795 @itemize @bullet
796 @item
797 Arithmetic operations may be rearranged for efficiency or compile-time
798 evaluation. When floating point numbers are involved, this may produce
799 different values or an overflow.
800 @item
801 Some arithmetic operations may be optimized away. For example, the
802 expression @code{(+ x)} may be optimized to simply @code{x}. If the
803 value of @code{x} is a marker, then the value will be a marker instead
804 of an integer. If the value of @samp{x} is a cons cell, then the
805 interpreter will issue an error, while the bytecode will not.
806
807 If you're trying to use @samp{(+ @var{object} 0)} to convert
808 @var{object} to integer, consider using an explicit conversion function,
809 which is clearer and guaranteed to work.
810 Instead of @samp{(+ @var{marker} 0)}, use @samp{(marker-position @var{marker})}.
811 Instead of @samp{(+ @var{char} 0)}, use @samp{(char-int @var{char})}.
812 @end itemize
813
814 For maximal equivalence between interpreted and compiled code, the
815 variables @code{byte-compile-delete-errors} and
816 @code{byte-compile-optimize} can be set to @code{nil}, but this is not
817 recommended.