|
|
|
|
|
by sersnth
2466 days ago
|
|
Your grep result of Linux is because the regex is bad. `\t` does not seem to be available in the grep basic syntax. It is available with Perl Compatible Regular Expressions, but then you can't use `\>`. Changing it to $ git grep -P '^[\t ].*[a-z].*\*[ ]*const\W' v4.9
returns 1,779 matches. Here are some from kernel/ v4.9:kernel/time/posix-cpu-timers.c: struct signal_struct *const sig = tsk->signal;
v4.9:kernel/tracepoint.c: struct tracepoint * const *end)
v4.9:kernel/tracepoint.c: struct tracepoint * const *iter;
v4.9:kernel/tracepoint.c: struct tracepoint * const *end,
v4.9:kernel/tracepoint.c: struct tracepoint * const *iter;
Many of the matches are the same as your "array of string constants" example, but just defined at local scope. And many are just constant local variables which some may not consider worth making const. The ones from tracepoint.c above are probably walking an array of const pointers by pointer instead of by index for example though, which is a common case where pointers to const pointers are used, which are legitimately useful. |
|