3 ms·
Seems to be found by grep fine: % echo 'int x = (int)1.2f;' > foo % grep '(int)' foo int x = (int)1.2f; Does greppable mean something else in this cont
by robotresearcher 4y ago
Seems to be found by grep fine:
% echo 'int x = (int)1.2f;' > foo
% grep '(int)' foo
int x = (int)1.2f;
Does greppable mean something else in this context?
- ghghgfdfgh 4y agoI'm assuming they didn't mean "grep" in a literal sense, rather that it is easier to find keywords like "reinterpret_cast" when scanning your eyes through code, whereas with C-style casts you'd have a much harder time.
- germandiago 4y agoYes I meant this. But grepping can also be a real problem.It is not just plain int what you cast.
- germandiago 4y agoNow find casts that are known to be as unsafe as reinterpret cast for the whole set of types your codebase deals with to audit a violation of the type system. What would you grep? I would grep 'reinterpret_cast' and I would set warning as error for the c-style casts. So you can assume my codebase does not have any. I will find any cast to reference, pointer, etc. for any type. How would you do tjat if you do: (int)a ((int)(MyType*)) and many, many more...
- robotresearcher 4y agoThat makes sense, thanks. Grepping for C syntax casts with arbitrary stuff between the parens is clearly not going to work.