Re: Do we care if C compilers start allowing "." on pointers?
David Malcolm <[email protected]>
| Newsgroups | org.kernel.vger.linux-toolchains |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2025-01-10 at 07:02 -0800, Paul E. McKenney 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? Is the proposal likely to actually happen to either C++ or C? I hope the proposal can be ignored; FWIW (with as a GCC diagnostics maintainer) the proposal seems a bad idea to me: the proposal (in "C++ Compiler modification notes") seems to be suggesting this is a relatively simple change to the compiler - but it seems to not account for: - the cost of teaching language users about the change - the cost of bifurcating the languages into before/after the change - providing useful compiler diagnostics if someone tries to compile code using this with an older version of the language - support for this in IDEs (e.g. code-completion) - dealing with smart pointers and operator overloading in C++ - in C++ this may open up a huge can of worms relating to template substitutions, since it (perhaps; not sure) might allow previously- failing substitutions to succeed, thus breaking existing codebases ...etc I don't buy the supposed motivations at all, e.g. "Simplifies the knowledge required to start programming in C" ...by adding a new fundamental way to do things, decades in; surely this just complicates things? C has its warts, but These are just my personal opinions, of course. Hope this is constructive Dave > > Thanx, Paul > > [1] > https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2142r1.pdf >