Saturday, June 14, 2014

Spelunking C++ members and methods

Hello,

Consider the use of code spelunking tools such as :tags (ctags),
:cscope, :Gtags or some other one on the following _skeletal_ code:

/* 1 */ class A
/* 2 */ {
/* 3 */ int x;
/* 4 */ void fun();
/* 5 */ }
/* 6 */ A::fun() { std::cout << x << "\n"; }
/* 7 */
/* 8 */ class B
/* 9 */ {
/* 10 */ int x;
/* 11 */ void fun();
/* 12 */ }
/* 13 */ B::fun() { std::cout << x*x << "\n"; }
/* 14 */
/* 15 */ main()
/* 16 */ {
/* 17 */ A u;
/* 18 */ B* x = new B();
/* 19 */
/* 20 */ u.x = 3;
/* 21 */ u.fun();
/* 22 */
/* 23 */ x->x = 5;
/* 24 */ x->fun();
/* 25 */ }


Can one find all of A's x and only A's x, getting hits on lines 3, 6,
and 20? If so, how exactly?

Can one find all of A's fun() and only A's fun(), getting hits on lines
4, 6, and 21? If so, how exactly?

Thanks,

--Suresh







--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: