S
Stefan Ram
RCollins said:Since you are calling main() recursively, aren't you actually
creating 3 different i's? Each i is _not_ the same, even though
they happen to have the same name.
Yes, one can see it this way.
Actually it depends on the mode of speech:
"Ronald" is a name.
Ronald is a person.
While there are more Ronalds than one Ronald, there is still
only one name "Ronald", but there are several Ronalds.
In the source code, there is exactly one identifier "i".
Executing the program does not change the number of "i"s in
the source code. The identifier "i" is a ("static") entity of
the source code model. An object is a ("dynamic") entity of
the execution model. How these models relate to each other is
being described by the C language specification.
"Bound"? I don't know what that means in C (although I understand
the concept from ProLog).
The specification in fact does not use this wording.
I am using the term "binding" to refer to a relation between
an identifier (as an element of the source code model) to an
object (as an element of the execution model). ISO/IEC 9899:1999
(E) uses wording such as "denotes", "designates" or "refers".
In this case, your example seems very
compiler-specific (or perhaps, optimization-specific). The compiler
is perfectly free to allocate memory storage to i, even if it is
never used to store a value. That would make i an object, regardless
of what (if anything) is stored in it.
Usually an "activation record" is created, when a function is
being executed, often on the "stack". The automatic variables
and parameter variables are bound to storage in this
"activation record". When a function is not being activated,
it would make no sense to create such an activation record,
although I can not exclude that some compiler might create
code to do so, but this would at least partially execute
a function, which is never called.