In article <gpadnZTfo-dlPB_ZnZ2dnUVZ_qmdnZ2d@comcast.com>,
Michael J. Mahon <mjmahon@aol.com> wrote:
mdj wrote:
Paul Schlyter wrote:
<snip>
I dondt think one can talk about namespaces at all regarding macros in
preprocessors. The preprocessor does not know what a namespace is. It
hardly knows anything about the underlying source language. Heck, you
can even replace reserved words with macros -- try to do THAT using
the global namespace in a normal way.....
Why? Namespaces are a natural extension present in most modern
languages to avoid collisions that occur frequently in larger programs.
Macro's being redefined by included headers from an unrelated piece of
code is a real problem in C/C++ programs.
Of course, most good programmers utilise some form of poor-mans
namespacing by prefixing their preprocessor names with something that's
likely to be unique. This illustrates the point that the feature would
be useful.
In the "olden days", assemblers frequently had HEAD "x" pseudo ops that
would treat all identifiers encountered from then on as if they had an
"x" prefixed to them, until the next HEAD operation.
This didn't produce any visible change in the labels, but it did serve
to create "local" scopes if the HEAD characters were well chosen.
-michael
In the Apple II world, the S-C Assembler implemented local labels which
had special names: a dot '.' followed by a decimal number from 0 to 99.
The local labels were visible only between one normal label and the
next -- after next normal label, all local label names could be reused.