Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-16 Thread Martin Sebor
On 07/16/2018 02:19 AM, Richard Sandiford wrote: Aldy Hernandez writes: On Thu, Jul 12, 2018 at 1:41 PM Jonathan Wakely wrote: On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: +Only use non-constant references in the following situations: + + + +when they are necessary to conform to

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-16 Thread Richard Biener
On Mon, Jul 16, 2018 at 11:48 AM Aldy Hernandez wrote: > > > > On 07/16/2018 04:19 AM, Richard Sandiford wrote: > > Aldy Hernandez writes: > >> On Thu, Jul 12, 2018 at 1:41 PM Jonathan Wakely > >> wrote: > >>> > >>> On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: > +Only use

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-16 Thread Aldy Hernandez
On 07/16/2018 04:19 AM, Richard Sandiford wrote: Aldy Hernandez writes: On Thu, Jul 12, 2018 at 1:41 PM Jonathan Wakely wrote: On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: +Only use non-constant references in the following situations: + + + +when they are necessary to conform

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-16 Thread Richard Sandiford
Aldy Hernandez writes: > On Thu, Jul 12, 2018 at 1:41 PM Jonathan Wakely wrote: >> >> On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: >> > +Only use non-constant references in the following situations: >> > + >> > + >> > + >> > +when they are necessary to conform to a standard interface,

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-16 Thread Aldy Hernandez
On Thu, Jul 12, 2018 at 8:02 PM Pedro Alves wrote: > > On 07/12/2018 05:17 PM, Richard Sandiford wrote: > > Pedro Alves writes: > > >> (an > >>> alternative to pointers is to return a struct with the wide int result > >>> and the overflow flag), > >> > >> +1. I've been pushing GDB in that

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-16 Thread Aldy Hernandez
On Thu, Jul 12, 2018 at 1:41 PM Jonathan Wakely wrote: > > On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: > > +Only use non-constant references in the following situations: > > + > > + > > + > > +when they are necessary to conform to a standard interface, such as > > +the first argument

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Martin Sebor
On 07/12/2018 04:41 AM, Richard Sandiford wrote: Following on from: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00603.html this patch is an RFC to mention references in the C++ coding conventions. It allows const references anywhere they're useful but only allows non-constant references

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Jonathan Wakely
On Thu, 12 Jul 2018 at 19:01, Pedro Alves wrote: > > On 07/12/2018 05:17 PM, Richard Sandiford wrote: > > Pedro Alves writes: > > >> (an > >>> alternative to pointers is to return a struct with the wide int result > >>> and the overflow flag), > >> > >> +1. I've been pushing GDB in that

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Pedro Alves
On 07/12/2018 05:17 PM, Richard Sandiford wrote: > Pedro Alves writes: >> (an >>> alternative to pointers is to return a struct with the wide int result >>> and the overflow flag), >> >> +1. I've been pushing GDB in that direction whenever possible. > > I agree that can sometimes be better. I

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Richard Sandiford
Pedro Alves writes: > On 07/12/2018 12:40 PM, Jonathan Wakely wrote: >> On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: >>> +Only use non-constant references in the following situations: >>> + >>> + >>> + >>> +when they are necessary to conform to a standard interface, such as >>> +the

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Pedro Alves
On 07/12/2018 12:40 PM, Jonathan Wakely wrote: > On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: >> +Only use non-constant references in the following situations: >> + >> + >> + >> +when they are necessary to conform to a standard interface, such as >> +the first argument to a non-member

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Jonathan Wakely
On Thu, 12 Jul 2018 at 11:41, Richard Sandiford wrote: > +Only use non-constant references in the following situations: > + > + > + > +when they are necessary to conform to a standard interface, such as > +the first argument to a non-member operator+= And the return value of such operators (which

Re: [RFC] Update coding conventions to restrict use of non-const references

2018-07-12 Thread Richard Biener
On Thu, Jul 12, 2018 at 12:41 PM Richard Sandiford wrote: > > Following on from: > > https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00603.html > > this patch is an RFC to mention references in the C++ coding conventions. > It allows const references anywhere they're useful but only allows >