Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C Names and Scopes Date: Wed, 08 Feb 2017 12:38:04 -0800 Organization: None to speak of Lines: 34 Message-ID: References: <87inokah37.fsf@bsb.me.uk> <1955fb97-35b4-446f-9bbd-65016ed217da@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="4a721828f74a91b51542c19008c4da11"; logging-data="32677"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fDrHOM+yYqkNvPlovM4A2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Z6zNbu2FnArmwtJ1rel7VxTKrR8= sha1:i3u4QIHgCq+RC5im0aVC+iv3r+M= Xref: csiph.com comp.lang.c:103487 BartC writes: [...] > For each unique identifier, there is one generic entry in that hash > table, joined to a linked list that contains all instances of that name > across all functions and blocks. (And, in the original scheme, across > all modules. But C likes modules to be compiled entirely independently > from each other.) [...] Just one small observation. If two separate scopes happen to define the same identifier, for example: void foo(void) { for (int i = 0; i < N; i ++) { /* ... */ } } void bar(void) { for (int i = 0; i < N; i ++) { /* ... */ } } then the two instances of the name "i" are completely independent. Consider whether it makes sense to include them both in the same linked list. (If the symbol table is used for things other than compiling code, it might well make sense.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"