Re: Do we care if C compilers start allowing "." on pointers?
Bill Wendling <[email protected]>
| Newsgroups | org.kernel.vger.linux-toolchains |
|---|---|
| Message-ID | <CAGG=3QWKVpoZAh_yD=15pkbRUVSeAmt5DJ94hKfxJ5HfTqV=Rg@mail.gmail.com> |
On Fri, Jan 10, 2025 at 7:02 AM Paul E. McKenney <[email protected]> wrote: > > Hello! > > Currently, given a pointer "p", C allows p->a but not p.a. There is a > proposal from C++ [1] that is being considered for C. > > Do we care? > Does the proposal seem likely to be added to C++? The motivation is very weak, in my opinion. Other languages are very different from C/C++; they try to hide away memory management details, which are a major part of C languages. (To prevent a holy war, my comments aren't about the benefits and drawbacks of memory management in other languages.) As for the kernel, if C/C++ adopt this convention, we won't be able to accept contributions which use '.' to access pointers until the minimum version of the compilers support this feature, which I imagine will take several years. My personal opinion would be to require '->' even when the option is available, unless a much better motivation is made. Cheers! -bw