Re: Larkin, Power BASIC cannot be THAT good:



Nobody wrote:
On Thu, 11 Jun 2009 11:30:18 -0700, Joel Koltner wrote:

Although I did once meet a C compiler that pretty much ignored the "const" part of "const int" and therefore actually allocated memory (in RAM!) and stored the value, fetching it again every time it was needed.

It's required to store it somewhere so that you can take its address.
"const" variables are still lvalues, not expressions.

A lot of the older compilers did that copy to ram even when they purported to generate code for embedded systems. The solution was to do the constant tables in assembler and then export a reference to them.

The physical address of a const in ROM is known at link time. And you can be sure that no attempt by the CPU to trash a ROM value will ever succeed. The same cannot be said of a value in ram if things go haywire.

This immutability of ROM did cause amusement in bank switched user register CPUs like the 9900 and 99k. You could tell it was in big trouble if the user register bank was in ROM where incrementing the program counter doesn't work any more.

I never appreciated at the time just how good the 99k was at interrupt handling until I tried to do the same job on a 68k series.

Regards,
Martin Brown
.



Relevant Pages

  • Re: Static Variables
    ... In random access memory, or "RAM" (or, if it's const, it might get put ... in which case they might go into ROM. ...
    (comp.lang.c)
  • Re: Static Variables
    ... You mean my implementation using pairs of goldfish to store each bit is not a conforming implementation? ... Assuming you mean automatic objects, they're stored in RAM, unless they're const, in which case they might go into ROM. ...
    (comp.lang.c)
  • ColdFire M5271 use 52Kb SRAM for C-stack to test DRAM at OS boot ?
    ... allocate C-stack there to test DRAM at the boot time? ... allocating stack on DRAM and jumping over it during DRAM test - anybody ... I need to run the RAM test before the bootrom copies itself into RAM, ... At this point the system is still executing instructions out of ROM. ...
    (comp.arch.embedded)
  • RE: I have a problem booting with Wce 6.0 (release) on Intel 855 gme b
    ... RAM 81C00000 02400000 RAM ... nk.exe:dwOEMTotalRAM 0 08000000 FIXUPVAR ... reserves for Watson dump capture. ... ceconfig.h (ROM 0x80A4F160) ...
    (microsoft.public.windowsce.embedded)
  • Re: DolphinDOS information needed (addendum)
    ... filled with the disk contents upon inserting every diskette. ... transfers were done from the RAM cache, which was very fast as it ... I have the ROM contents for DD2 and the drive side of DD3. ...
    (comp.sys.cbm)