2 ms·
C lacks the information given to the compiler to do this. It can't be added without adding that to the language. So no linter can do this alone, without languag
by SAI_Peregrinus 6y ago
C lacks the information given to the compiler to do this. It can't be added without adding that to the language. So no linter can do this alone, without language changes.
- dependenttypes 6y agoYou can use _Pragma/#pragma, regardless though, you can achieve a lot of what lifetimes can without any annotation.
- SAI_Peregrinus 6y agoPragmas are extensions to C, not part of the C language standard. You can add things to C, but it then ceases to be standard C and becomes GNU C or MS Visual C or early C++ or something else. But not ISO Standard C. And yes, just about anything non-lexical lifetimes can do you can do with static analysis. But the set of things you can do with Rust includes things that need explicit lifetime annotations, which C doesn't have.