Re: Microchip Introduces First 16-bit Microcontroller Product Line - the PIC24



Paul Burke <paul@xxxxxxxxxx> wrote:
> Mark L Pappin wrote:

> > unsigned char lives_in_RAM = 'a';
> > const unsigned char lives_in_ROM = 'b';

> This really is one of the major problems of C.

No. If it's a problem, then it's one of the C compiler in question.
If you declare an object 'const', in C, a compiler for a target system
that has ROM space available has all the liberty needed to put it in
ROM. If the tools don't do so, that's not the fault of the language,
but a quality issue with the tools, or possibly a usage error (not
turning on the relevant compiler/linker option).

C doesn't provide a mechanism for portable programs to force the
translator to put objects to be in non-writable storage. But that's
not a problem, that's a designed-in feature of the language. Such
programs would be gratuitously unportable.

--
Hans-Bernhard Broeker (broeker@xxxxxxxxxxxxxxxxxxxxx)
Even if all the snow were burnt, ashes would remain.
.


Quantcast