Topic: Implementing Name Lookup Rules in C++


Author: mshetty@mail.com (mshetty)
Date: Sat, 2 Feb 2002 16:24:57 GMT
Raw View
Hi,

How does a compiler resolves names in case a UDT is defined at
multiple places, how does the searching go on ?? In the following
example the struct with a short member is used ?? How is this achieved
?? I know that a complier begins by successively searching enclosing
scopes but I don't know how to code it.
        class yyy
        {
                public:
                class xxx
                {
                        public:
                        struct aaa
                        {
                                long ln;
                        };
                };
        };


class qqq
{
        public:
        class yyy
        {
                public:
                class xxx
                {
                        public:
                        struct aaa
                        {
                                short sh;
                        };
                };
        };

        class zzz
        {
                public:
                class bbb
                {
                        void op1(yyy::xxx::aaa aaa_var);
                };
        };
};

Would help if I could get some suggestions on how to implement it in
C++ (Is there a site that talks of the above ??).

Thanks and Regards,
M Shetty

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Sat, 2 Feb 2002 21:02:58 GMT
Raw View
In article <bfbb8fd4.0202020221.1af75135@posting.google.com>, mshetty
<mshetty@mail.com> writes
>How does a compiler resolves names in case a UDT is defined at
>multiple places, how does the searching go on ?? In the following
>example the struct with a short member is used ?? How is this achieved
>?? I know that a complier begins by successively searching enclosing
>scopes but I don't know how to code it.

Please do not do this. I.e. please cross-post if you want your article
to appear in more than one newsgroup, instead of posting separately to
more than one group.

In addition, I think that this post does not concern the standard and
was, therefore, correctly posted to comp.lang.c++.moderated and should
not have been posted here.


--
Francis Glassborow
Check out the ACCU Spring Conference 2002
4 Days, 4 tracks, 4+ languages, World class speakers
For details see: http://www.accu.org/events/public/accu0204.htm

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: mshetty@mail.com (mshetty)
Date: Sun, 3 Feb 2002 18:57:16 GMT
Raw View
> Please do not do this. I.e. please cross-post if you want your article
> to appear in more than one newsgroup, instead of posting separately to
> more than one group.

Ok
> In addition, I think that this post does not concern the standard and
> was, therefore, correctly posted to comp.lang.c++.moderated and should
> not have been posted here.

I had actually posted in comp.compilers. This is the reply I got -
"The C++ name resolution rules are defined in the C++ standard.  Btter
ask comp.std.c++."
and that's why this post

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]