|Symbol conflict in HashTable for variable email@example.com (2001-11-14)|
|Re: Symbol conflict in HashTable for variable firstname.lastname@example.org (2001-11-17)|
|From:||email@example.com (Alex Colvin)|
|Date:||17 Nov 2001 00:38:12 -0500|
|Organization:||The World Public Access UNIX, Brookline, MA|
|Posted-Date:||17 Nov 2001 00:38:12 EST|
>My question : What could be the best to do when i've got two
>variable with the same name (perhaps they are in two different function or
>something else...), i use the name of variable as key in my hashTable.
>For information, i can't use two or more Hashtables.
Then you'll have to use one, but it will have to store all the variables
with the same name. It will also have to have some way to tell them apart.
One structure that I've used is to label all the scopes (functions,
classes, compound statements, ...), and store that along with the
definition, Then you can find the right definition by remembering which
scopes are active.
This works well in the typical case where there is only one definition,
and correctly in the case where they all have the same name. It also makes
entering and exiting scopes nearly free.
mac the naïf
Return to the
Search the comp.compilers archives again.