I am sorry Bart;
In an effort to be brief, I mis-asked the question.
On Mon, 2007-08-20 at 10:42 -0400, Bart Trojanowski wrote:
> * William Case <billlinux [ at ] rogers [ dot ] com> [070820 10:22]:
> > Hi;
> >
> > I have several paragraphs of notes regarding the 'namespace' concept.
> > Those notes, however, leave some ambiguity. (Trying to cast the widest
> > possible net to capture all possibilities -- I suspect.) I don't need
> > a full explanation of what a namespace is other than to confirm which of
> > the following possibilities could be called a 'namespace'.
> >
"ANSI C A-11 Scope and Linkage
...
Therefore, there are two kinds of scope to consider; first the lexical
scope of an identifier, which is the region of a program text within
which the identifiers characteristics are understood; and second, the
scope associated with objects and functions with external linkage,
which determines the connections between identifiers in separately
compiled translation units -- [OK, got that]
A-11.1
Identifiers fall into different name spaces that do not interfere with
one another; the same identifier may be used for different purposes,
even in the same scope, if the uses are in different name spaces. These
classes are: objects, functions, typedef names and enum constants;
labels; tags of structures; unions and enumerations; and members of each
structure or union individually."
[Here (A-11.1) the words 'name space' are used without being described
or defined here or elsewhere.]
>
> > If I write the 'bills_program' in C and then call it, is a 'name space'
^
>
> First, C doesn't have namespaces. C++ does.
I am re-working through C to get to C++. I was vaguely aware of
namespace in C++ but didn't appreciate how it could get confused with
name space.
>
> > I. bills_program
> > II. main()
> > III. function() -- within main
>
> Avoid defining private functions inside other functions. I am not sure
> if that's what you mean here. But GCC extensions let you do this:
>
> int main (void)
> {
> int function (int b) {
> return a * 2;
> }
>
> ...
> }
>
I didn't mean to imply that one function was defined within another.
But, certainly one function is called from within another. So, does the
name space include that function call + the subsequent function
definition or is the function defined in a new name space.
> > IV. each of the above
> > V. more
> > VI. something else
>
> > I understand 'name space' as an abstraction that is used as a root idea
^
> > for memory allocations or use, which is subdivided into various other
> > concepts (eg text, bbs, stack, stack frame etc.) depending on the
> > organization of a called program.
>
> C++ namespaces have nothing to do with that.
>
'Namespace, was a mistake. A lack of knowledge of C++. Read 'name
space'.
> > While I am at it. When a program is called, how does the processor know
> > how much memory to allocate for that program. Is it one page at a time,
> > one process at a time or does the compiler put a size number in the file
> > header, or what ?
>
> Processor doesn't know.
>
> The operating system will load up the data from disk into ram as it's
> used. For example glibc is huge. No program uses all of it. If no one
> is interested in a particular 4k of glibc, it's never loaded into
> memory.
>
> Memory is allocated based on the elf header.
>
>
> > Please just point me, I am willing to read.
>
> man elf
> man readelf
That solves that part. Will look at the goobly-gook of elf again. (It's
not really goobly-gook. It is more like Greek to me.)
> -Bart
>
--
Regards Bill