[Coco] CMOC C-like cross-compiler now supports const

Pierre Sarrazin sarrazip at sarrazip.com
Wed Mar 21 18:39:53 EDT 2018


Hi James,

Types like `const char *' are supported.

Read-only globals are put in the read-only section, next to the code,
and references to those globals are made with ,PCR.

Writable globals are put in the data section, and references to those
globals are made with ,Y, where Y points to the data segment.

If there is a C program example that might cause trouble under OS-9,
I'll try it out.


Dixit James Jones (2018-03-20 20:24):
> Can pointer types be const qualified? That causes major difficulties in
> OS-9, because position-independent code and data that lives in some place
> determined at run time and pointed at by a register makes it impossible to
> correctly do const-qualified pointers.
> 
> 
> On Tue, Mar 20, 2018 at 7:14 PM, Pierre Sarrazin <sarrazip at sarrazip.com>
> wrote:
> 
> > - The `const' keyword is now supported. Warnings are issued for
> >   statements that are not const-correct. The warnings can be silenced
> >   by giving the command-line option "-Wno-const".
> >
> >   Global arrays of const integers are automatically put in the read-only
> >   data section, which should make the #pragma const_data directive
> >   obsolete.
    [...]

-- 
Pierre Sarrazin <sarrazip @ sarrazip . com>


More information about the Coco mailing list