[Coco] [Color Computer] Multiple C compiler projects

James Jones jamesjones01 at mchsi.com
Mon Jul 18 06:33:29 EDT 2005


Gene Heskett wrote:

> James, that doesn't coincide with my experience.  I have often made 
> reference to a constant contained in an fdb in the program module 
> itself by simply accessing it ,pcr style.

_You_ have. You were writing assembly language by hand.  In the absence 
of the "const" type qualifier, the C compiler can't tell whether it can 
keep initialized variables in the program module and use PC-relative 
addressing to get to it. (That's not quite true--it could potentially be 
done for static variables that the compiler sees never has its address 
taken.)  Microware's 6809 compiler's putting string constants in code 
was unusual in the pre-ANSI era; back then, it was SOP in pcc/Unix to 
hand a string constant to mktemp() and expect it to be overwritten, so 
that it could not be kept purely in code.

> Are you forgetting that one of the more important advantages of the 
> 6x09 family is its ability to use program counter independent code, 
> code that will run at any loading address in the machines 64k map?

If I were forgetting it, would I be suggesting that the compiler take 
advantage of it?

> By the same token, pointers can be fcb'd at build time, and used to 
> form an address into a table of subroutines from those fdb'd 
> pointers.  Adding gettst's and settst's to the system is done very 
> much like that.

The ANSI C standard requires that const-qualified data be no different 
in format than the same data without const qualification. It has to, 
because of the way it defines the semantics of const qualification 
(which is a misnomer; the old DEC VMS C compiler used "readonly", which 
would've been a far better choice).

	James Jones




More information about the Coco mailing list