Previous: Disassembly, Up: Byte Compilation [Contents][Index]
The intent is that compiled byte-code and the corresponding code executed by the Lisp interpreter produce identical results. However, there are some circumstances where the results will differ.
(+ x) may be optimized to simply x. If the
value of x is a marker, then the value will be a marker instead
of an integer. If the value of ‘x’ is a cons cell, then the
interpreter will issue an error, while the bytecode will not.
If you’re trying to use ‘(+ object 0)’ to convert object to integer, consider using an explicit conversion function, which is clearer and guaranteed to work. Instead of ‘(+ marker 0)’, use ‘(marker-position marker)’. Instead of ‘(+ char 0)’, use ‘(char-int char)’.
For maximal equivalence between interpreted and compiled code, the
variables byte-compile-delete-errors and
byte-compile-optimize can be set to nil, but this is not
recommended.