TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BLAKE GAFFNEY
from: DARIN MCBRIDE
date: 1998-03-12 21:03:00
subject: Scope of qualified declarators

 BG> Is this valid C++ code? And would identifier "qwe" in 
 BG> the bizarre definition of foo() refer to ::qwe or 
 BG> bar::qwe (illegal anyway)?
 BG> int qwe;
 BG> int foo();
 BG> class bar {
 BG> public:
 BG>  int qwe;
 BG>  int ::foo() {return qwe;}
 BG> };
Simply trying to compile this should show you that either it is illegal code, 
or your compiler wouldn't support it anyway.  For a matter of record, I would 
believe it to be illegal (or "malformed" or some other term) code.
I took your code above as is (a.cc) and threw it at gcc 2.7.2.1:
[0] d:\src\z>gcc -c a.cc
a.cc:8: parse error before `('
This would be referring to the "int ::foo()" line - and the parse is before 
the opening parenthesis of foo().
At any rate, the code makes zero sense to me anyway - what is it exactly that 
you are trying to do?  Is it just try bizarre scenarios, or is there a 
problem that would be solved by this construct?  If the latter, let us know 
what it is and we should be able to help you with the "correct" method.  :-)
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.