Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Scopes of identifiers Date: Wed, 10 Apr 2019 22:04:42 -0700 Organization: None to speak of Lines: 19 Message-ID: References: <098da5fe-31d3-47b7-b695-d4faea10b366@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="87362217ce2e2b0a1d2135c8fdf71e43"; logging-data="18028"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+r8C/rHHv9xEU5NRzcrCwk" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:4Dc1yJDAtazP9LyH8RpDYt1JHiU= sha1:fo4MlyrhfKM2UihSLh/Vk5Tu+d4= Xref: csiph.com comp.lang.c:143001 BGB writes: [...] > Though, in terms of behavior, I suspect GCC may use two separate scopes, > one for global variables and one for functions. Accessing a variable or > calling a function will first check one, then the other. It may then in > certain cases allow variables and functions to exist with the same names > (whereas both my compiler and MSVC seem to reject this outright). Names of objects and names of functions follow the same scoping rules, with inner declarations hiding outer declarations of the same name. Do you have an example where gcc accepts a function and a variable with the same name, declared in the same scope? [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */