Re: Symbol tables and scopes

"David R Tribble" <david@tribble.com>
24 Feb 2006 09:42:11 -0500

          From comp.compilers

Related articles
[13 earlier articles]
Re: Symbol tables and scopes DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-02-14)
Re: Symbol tables and scopes david.thompson1@worldnet.att.net (Dave Thompson) (2006-02-14)
Re: Symbol tables and scopes alexc@TheWorld.com (Alex Colvin) (2006-02-14)
Re: Symbol tables and scopes nathan.moore@cox.net (Nathan Moore) (2006-02-17)
Re: Symbol tables and scopes alexc@TheWorld.com (Alex Colvin) (2006-02-17)
Re: Symbol tables and scopes david@tribble.com (David R Tribble) (2006-02-24)
Re: Symbol tables and scopes david@tribble.com (David R Tribble) (2006-02-24)
Re: Symbol tables and scopes david@tribble.com (David R Tribble) (2006-02-24)
Re: Symbol tables and scopes david@tribble.com (David R Tribble) (2006-02-24)
Re: Symbol tables and scopes DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-03-05)
Re: Symbol tables and scopes henry@spsystems.net (2006-03-05)
| List of all articles for this month |

From: "David R Tribble" <david@tribble.com>
Newsgroups: comp.compilers
Date: 24 Feb 2006 09:42:11 -0500
Organization: http://groups.google.com
References: 06-01-10106-02-027 06-02-045 06-02-056 06-02-063 06-02-086
Keywords: symbols

Alex Colvin wrote:
>> Figure that a name is declared in very few blocks, but some blocks contain
>> very many names. Typically, the outermost scope contains hundreds of
>> global names that are never redeclared. I believe this is called the "Big
>> Inhale"
>


Carl Barron wrote:
> Depends on the language and programming style. It may be true for
> C, Pascal and similiar languages, but i question the validity on a
> typical C++ program for example. Definitely a reasonably well designed
> program will attempt to minimize the # of global variables, if the
> language allows it.


Precisely the reason I use the Java approach to C++ global variables,
i.e., I try to make everything a member of some class, including global
variables, which can be declared as public static members of classes.
Thus any use of a "global" variable requires a classname prefix.


C++ namespaces provide similar functionality.


For languages that don't have classes or namespaces, like C, I
use a unique affix on related names. Not as good a solution,
true, but usually sufficient.


-drt


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.