2 ms·
I have a macro or function name that occurs wherever the struct is initialized. struct point p = point_init(x, y); ctags will find the definition of point_i
by kazinator 7y ago
I have a macro or function name that occurs wherever the struct is initialized.
struct point p = point_init(x, y);
ctags will find the definition of point_init, and cscope all the occurrences.
Random code throughout the program that is not related to the data type's module shouldn't be performing explicit low-level member-for-member initializations of the data type, even with a safer mechanism like designated initializers.
- cryptonector 7y agoYes, but if you have a struct with many functions then you still have a problem. With designated initializers I can traverse all the paths through cscope alone.
- kazinator 7y agoI can't even begin to imagine a foggy gist of what you might be talking about, but it seems very real to you.
- cryptonector 7y agoI should do an asciicinema thing, I guess. Point is, I can search for assignments to any one function-typed fieldname of a struct and find all the functions that are reachable through instances of that struct.
- kazinator 7y agoAre we (still) talking about C here? Initialization isn't assignment in C; structure elements are called "members" and they cannot be functions.