When you say 'internally by compilers', it seems to me that you
mean during compilation.
< I assume that it's probably null-terminated character string for
< C and C++ and some kind of length-prefixed thing for Pascal in a specially
< designated data segment area and then just some sort of pointer for a given
< literal is placed in the code, yes?
Those seem likely for the object code and run time representation
for constants. Internally to the compiler, they are likely in
the representation for the language that the compiler is written in.
I would not be surprised to see C compilers in Pascal, or Pascal
compilers in C, though I don't actually know of any. (I haven't
looked very hard.)
The other question for constants, is whether you combine multiple
instances of the same constant into one. It gets interesting if
it is possible, even accidentally, to modify constants.
(Traditionally fun for Fortran, which usually passes arguments
by reference, even constants. Also, K&R C allows string constants
to be modified, though ANSI removed that feature.)
-- glen
> I would not be surprised to see C compilers in Pascal, or Pascal
> compilers in C, though I don't actually know of any. (I haven't
> looked very hard.)
Most of our C compilers are written in Delphi Pascal. It is a long
story of history, string support, sets and typechecking.
Regards,
--
Walter Banks
Byte Craft Limited
http://www.bytecraft.com