Re: Do we care if C compilers start allowing "." on pointers?
"Paul E. McKenney" <[email protected]>
| Newsgroups | org.kernel.vger.linux-toolchains |
|---|---|
| Message-ID | <a9db815b-7ca7-41c1-91e5-a3152f01ade7@paulmck-laptop> |
On Sat, Jan 11, 2025 at 12:12:45PM -0500, David Malcolm wrote: > 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 Thank you all! There is a definite trend thus far. ;-) Thanx, Paul