HP Forums

Full Version: C translator for calculator project
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Quote:The weird thing about the Intel Decimal library is the huge tables repeated verbatim in various source files. Maybe that makes the code slightly faster, but it uses up a lot of precious space on a small, embedded system like a calculator.
That's interesting. Are you sure the compiler isn't smart enough to keep just one copy of the table?
(06-09-2019 09:31 PM)Druzyek Wrote: [ -> ]
Quote:The weird thing about the Intel Decimal library is the huge tables repeated verbatim in various source files. Maybe that makes the code slightly faster, but it uses up a lot of precious space on a small, embedded system like a calculator.
That's interesting. Are you sure the compiler isn't smart enough to keep just one copy of the table?

Typically, the different C files are compiled individually and then the resulting object files are linked. But in C speak, those tables are declared with internal linkage (declared 'static'), so are invisible to the linker, so you'd end up with multiple copies.

Some compilers have "whole program optimization" modes, which might be able to detect they are identical and combine them, in theory.
After considering several options I've decided to write the C translator first. This can then be used as a basis for translators for other programming languages. See the new keypad layout and colour display here.

Here is a paper on writing a compiler, which would be interesting to try one day.
Pages: 1 2 3
Reference URL's