Post Reply 
C translator for calculator project
06-09-2019, 09:31 PM
Post: #41
RE: C translator for calculator project
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?
Find all posts by this user
Quote this message in a reply
06-09-2019, 10:39 PM
Post: #42
RE: C translator for calculator project
(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.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
06-20-2019, 08:29 AM (This post was last modified: 07-09-2019 12:17 AM by Dan.)
Post: #43
RE: C translator for calculator project
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.

Dan has left the building
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)