Re: Coding style for C++ constructs going forward

2020-08-13 Thread Jonathan Wakely via Gcc
On Thu, 13 Aug 2020 at 08:52, Metzger, Markus T wrote: > > Hello, > > > It seems like common sense to me. "Almost always use auto" is a silly > > guideline. I can't stand seeing nonsense like: > > > > auto main() -> int > > { ... } > > I personally do not like auto for reasons like the above or >

Re: Coding style for C++ constructs going forward

2020-08-13 Thread Jonathan Wakely via Gcc
On Thu, 13 Aug 2020 at 07:46, Liu Hao via Gcc wrote: > > 在 2020/8/13 上午2:40, David Blaikie 写道: > > > > Then use of `auto*` would make it easier for you to spot use of plain > > pointers in your projects & scrutinize them further? > > > > My point is that `auto*` conveys no more information than

RE: Coding style for C++ constructs going forward

2020-08-13 Thread Metzger, Markus T via Gcc
Hello, > It seems like common sense to me. "Almost always use auto" is a silly > guideline. I can't stand seeing nonsense like: > > auto main() -> int > { ... } I personally do not like auto for reasons like the above or auto foo = bar->foo (); I find this very hard to read and I also

Re: Coding style for C++ constructs going forward

2020-08-13 Thread Liu Hao via Gcc
在 2020/8/13 上午2:40, David Blaikie 写道: > > Then use of `auto*` would make it easier for you to spot use of plain > pointers in your projects & scrutinize them further? > My point is that `auto*` conveys no more information than `auto`. The absence of `*` does not imply the object (pointer)

Re: Coding style for C++ constructs going forward

2020-08-12 Thread David Blaikie via Gcc
On Tue, Aug 11, 2020 at 7:49 PM Liu Hao via Gdb wrote: > > 在 2020/8/11 下午9:55, Nathan Sidwell 写道: > > > > I agree, it's the way I use auto. I particularly like the > >auto *foo = expr; > > idiom, when you're getting a pointer, but the type of the pointee is clear. > > It informs how you

Re: Coding style for C++ constructs going forward

2020-08-11 Thread Liu Hao via Gcc
在 2020/8/11 下午9:55, Nathan Sidwell 写道: > > I agree, it's the way I use auto.  I particularly like the >    auto *foo = expr; > idiom, when you're getting a pointer, but the type of the pointee is clear.  > It informs how you use 'foo'. > > Personally I dislike this syntax. Pointers are

Re: Coding style for C++ constructs going forward

2020-08-11 Thread Jonathan Wakely via Gcc
On Tue, 11 Aug 2020 at 14:56, Nathan Sidwell wrote: > > On 8/7/20 10:06 AM, Luis Machado via Gcc wrote: > > Hi, > > > > cc-ing the GCC mailing list, as we may want to use the same coding style > > for GDB and GCC. > > > > Yesterday I brought this topic up on IRC. I notice we started using more >

Re: Coding style for C++ constructs going forward

2020-08-11 Thread Nathan Sidwell
On 8/7/20 10:06 AM, Luis Machado via Gcc wrote: Hi, cc-ing the GCC mailing list, as we may want to use the same coding style for GDB and GCC. Yesterday I brought this topic up on IRC. I notice we started using more and more the "auto" keyword. In some cases, this is actually useful and

Re: Coding style for C++ constructs going forward

2020-08-07 Thread Christian Biesinger via Gcc
On Fri, Aug 7, 2020 at 9:06 AM Luis Machado via Gdb wrote: > > Hi, > > cc-ing the GCC mailing list, as we may want to use the same coding style > for GDB and GCC. > > Yesterday I brought this topic up on IRC. I notice we started using more > and more the "auto" keyword. In some cases, this is

Re: Coding style for C++ constructs going forward

2020-08-07 Thread Jonathan Wakely via Gcc
On Fri, 7 Aug 2020 at 15:08, Luis Machado via Gcc wrote: > > Hi, > > cc-ing the GCC mailing list, as we may want to use the same coding style > for GDB and GCC. > > Yesterday I brought this topic up on IRC. I notice we started using more > and more the "auto" keyword. In some cases, this is

Re: Coding style for C++ constructs going forward

2020-08-07 Thread Jakub Jelinek via Gcc
On Fri, Aug 07, 2020 at 07:56:03AM -0700, Joel Brobecker wrote: > > Pedro has pointed out LLVM's coding standards for "auto", which we may or > > may not want to follow/adopt: > > https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable Also see the

Re: Coding style for C++ constructs going forward

2020-08-07 Thread Joel Brobecker
Hi Luis, > cc-ing the GCC mailing list, as we may want to use the same coding style for > GDB and GCC. > > Yesterday I brought this topic up on IRC. I notice we started using more and > more the "auto" keyword. In some cases, this is actually useful and makes > the code a bit more compact. GDB

Coding style for C++ constructs going forward

2020-08-07 Thread Luis Machado via Gcc
Hi, cc-ing the GCC mailing list, as we may want to use the same coding style for GDB and GCC. Yesterday I brought this topic up on IRC. I notice we started using more and more the "auto" keyword. In some cases, this is actually useful and makes the code a bit more compact. GDB has been