How to find struct member uses with cscope and ignore local variables?

蹲街弑〆低调 提交于 2019-12-04 23:43:15

I don't think there is any way to get cscope to differentiate between the local variable x and the structure member variable.

The way we solve this problem at my company is to use a unique naming scheme for the member variables that helps differentiate them:

typedef struct _s{    
    int s_x;
} S;

It's a little bit awkward at first, but once you get used to it, it does make it easier to navigate the code. Usually the uniquifier is only a few characters relevant to the structure, and it doesn't clutter things up too badly.

Instead of searching for x, you can position your cursor on the structure variable "my_s" and then press the key combination "gd". This will position you on the definition of my_s and then use cscope to find the definition of S.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!