Any program or trick to find the definition of a variable?

前端 未结 8 1029
梦谈多话
梦谈多话 2021-01-02 09:01

Many times when I am watching others code I just want to find where and how a variable is defined. Normally what I do now is look for the type of the variable until I find t

8条回答
  •  走了就别回头了
    2021-01-02 09:38

    Grep for common patterns for variable declarations. Example: *, &, > or an alphanumeric followed by one or more whitespace characters then the name of the variable. Or variable name followed by zero or more whitespace characters, then a left parenthesis or a semicolon. Unless it was defined under really weird circumstances (like with some kind of macro), it works every time.

提交回复
热议问题