Re: [Development] RFF: nullptr rules

2015-12-18 Thread Thiago Macieira
On Friday 18 December 2015 14:04:03 René J. V. Bertin wrote: > I saw mention of a Q_xxx macro in this thread (and lots of code using it). > If it has been argued here already, let me add my voice to the opinion that > this implies a Qt-specific type that should only be used in calls to Qt > functio

Re: [Development] RFF: nullptr rules

2015-12-18 Thread René J . V . Bertin
The invention of the 0 concept was a revolution; are we facing something similar here? :) Milian Wolff wrote: > This, for me, is btw. a very strong argument in favor of requesting nullptr > everywhere. Or of using 0 everywhere, but not having read the entire thread I must presume good reason

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Thiago Macieira
On Thursday 10 December 2015 16:24:02 Sergio Martins wrote: > > But I don't think we should mandate use of nullptr everywhere. Where it's > > unambiguous, it doesn't add value. > > bool foo = 0; > > This is unambiguous, just like your "const char *ptr = 0" example, so "= > false" wouldn't add val

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Jocelyn Turcotte
> On 09 Dec 2015, at 23:29, Thiago Macieira wrote: > > I'd like to propose this: > a) no massive replacement or clang-modernize, for the reasons Richard pointed > out > b) which means existing zeroes continue in sources and private headers > c) which means no -Werror=zero-as-nullptr outside of

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Joerg Bornemann
On 10-Dec-15 17:23, Sergio Martins wrote: - in some situations, it makes code easier to understand (: m_foo(nullptr)). So nullptr is easier to understand, because assigning 0 to a pointer variable didn't make clear that it now contains a null pointer? If there's need to signify using m_foo(null

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Sergio Martins
On Wednesday, 9 December 2015 16:38:02 WET Joerg Bornemann wrote: > > - in some situations, it makes code easier to understand (: > > m_foo(nullptr)). > So nullptr is easier to understand, because assigning 0 to a pointer > variable didn't make clear that it now contains a null pointer? > If there

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Sergio Martins
On Wednesday, 9 December 2015 14:29:19 WET Thiago Macieira wrote: > On Wednesday 09 December 2015 22:47:51 Marc Mutz wrote: > > > const char *ptr = 0; > > > > What we agreed on was for Q_NULLPTR. > > > > Some developers back then were complaining that the *macro* is ugly, and > > that by

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Joerg Bornemann
On 10-Dec-15 15:25, Bubke Marco wrote: I think it less a technical issue. To me it looked very perlish to use zero to mark a defined invalid pointer but C++ is full of this expert language hacks. You still will need this thourough expert knowledge if you encounter a crash and the backtrace/de

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Bubke Marco
02 PM To: development@qt-project.org Subject: Re: [Development] RFF: nullptr rules On 10-Dec-15 14:36, Marc Mutz wrote: > As for why we need to have rules for nullptr: It's a funny you should ask, > because you're contributing to a project that mandates the placement of {}s in

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Joerg Bornemann
On 10-Dec-15 14:36, Marc Mutz wrote: As for why we need to have rules for nullptr: It's a funny you should ask, because you're contributing to a project that mandates the placement of {}s in minute detail. It's unclear why there should be no guideline for 0 vs. nullptr if there is for for() vs.

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Milian Wolff
On Donnerstag, 10. Dezember 2015 14:36:49 CET Marc Mutz wrote: > As for why we need to have rules for nullptr: It's a funny you should ask, > because you're contributing to a project that mandates the placement of {}s > in minute detail. It's unclear why there should be no guideline for 0 vs. >

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Marc Mutz
On Thursday 10 December 2015 10:25:14 Joerg Bornemann wrote: > On 09-Dec-15 19:41, Marc Mutz wrote: > > What part of "author's prerogative" was unclear? > > Unclear is, why you take the time to answer but horribly fail to explain > why you deem it necessary to enforce this particular insignificant

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Olivier Goffart
On Thursday 10. December 2015 10:52:15 Mathias Hasselmann wrote: > Am 09.12.2015 um 17:45 schrieb Mathias Hasselmann: > > Am 09.12.2015 um 16:14 schrieb Marc Mutz: > >> Arguments in favour: > >> - it's the C++ way of writing the null pointer constant these days > >> - we need to use it in headers,

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Mathias Hasselmann
Am 09.12.2015 um 17:45 schrieb Mathias Hasselmann: Am 09.12.2015 um 16:14 schrieb Marc Mutz: Arguments in favour: - it's the C++ way of writing the null pointer constant these days - we need to use it in headers, anyway, to allow people to use -Wzero-as..., and it makes no sense to have

Re: [Development] RFF: nullptr rules

2015-12-10 Thread Joerg Bornemann
On 09-Dec-15 19:41, Marc Mutz wrote: What part of "author's prerogative" was unclear? Unclear is, why you take the time to answer but horribly fail to explain why you deem it necessary to enforce this particular insignificant language glitch fix. Thanks, Joerg ___

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Thiago Macieira
On Wednesday 09 December 2015 17:41:26 Matthew Woehlke wrote: > On 2015-12-09 17:29, Thiago Macieira wrote: > > On Wednesday 09 December 2015 22:47:51 Marc Mutz wrote: > > > > I'd like to propose this: > > [...] > > c) which means no -Werror=zero-as-nullptr outside of headersclean > > I just wa

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Matthew Woehlke
On 2015-12-09 17:29, Thiago Macieira wrote: > On Wednesday 09 December 2015 22:47:51 Marc Mutz wrote: > I'd like to propose this: > [...] > c) which means no -Werror=zero-as-nullptr outside of headersclean I just want to say that I think this is fair. The key phrase there is "outside of". -Wzero

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Thiago Macieira
On Wednesday 09 December 2015 22:54:22 Marc Mutz wrote: > Whatever happened to KISS? That's a good reason not to run clang-modernize and force people to review. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Thiago Macieira
On Wednesday 09 December 2015 22:47:51 Marc Mutz wrote: > > const char *ptr = 0; > > What we agreed on was for Q_NULLPTR. > > Some developers back then were complaining that the *macro* is ugly, and > that by 5.7, we would be able to use the real thing and didn't want the > double convers

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Marc Mutz
On Wednesday 09 December 2015 16:14:00 Marc Mutz wrote: > Hi, > > in 5.7, nullptr (Q_C_NULLPTR) is required to be supported by the compiler, > but there are no guidelines as to its use in the coding conventions (to > the extent they need to be in there). > > I propose the following, based on Thia

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Marc Mutz
On Wednesday 09 December 2015 19:11:29 Thiago Macieira wrote: > On Wednesday 09 December 2015 16:14:00 Marc Mutz wrote: > > - 0 as a nullptr constant is banned except in tests testing APIs so > > > > we don't accidentally require nullptr (ie. all tests should use 0, not > > nullptr, as far as i

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Thiago Macieira
On Wednesday 09 December 2015 16:14:00 Marc Mutz wrote: > - 0 as a nullptr constant is banned except in tests testing APIs so > we don't accidentally require nullptr (ie. all tests should use 0, not > nullptr, as far as it makes sense) This is not what we had agreed to. We had said that where

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Marc Mutz
On Wednesday 09 December 2015 16:38:02 Joerg Bornemann wrote: > > - if (!foo) vs. if (foo == nullptr), if (foo) vs. if (foo != nullptr): > >author's prerogative[1] [...] > > [1] I prefer the short form, but I don't think we'll gain a consensus > > here, so let's not even try > > So why do you

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Marc Mutz
On Wednesday 09 December 2015 16:19:38 Matthew Woehlke wrote: > > - APIs that require the use of nullptr for disambiguation are > > discouraged, > > > > but may be acceptable to be decided on a case-by-case basis. > > On that note, there is one case in which '0' as nullptr makes sense... > defau

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Mathias Hasselmann
Am 09.12.2015 um 16:14 schrieb Marc Mutz: Arguments in favour: - it's the C++ way of writing the null pointer constant these days - we need to use it in headers, anyway, to allow people to use -Wzero-as..., and it makes no sense to have two sets of rules for headers and impl - it can disamb

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Joerg Bornemann
On 09-Dec-15 16:14, Marc Mutz wrote: in 5.7, nullptr (Q_C_NULLPTR) is required to be supported by the compiler, but there are no guidelines as to its use in the coding conventions (to the extent they need to be in there). There are also no guidelines for every other language feature, and I do

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Matthew Woehlke
On 2015-12-09 10:14, Marc Mutz wrote: > in 5.7, nullptr (Q_C_NULLPTR) is required to be supported by the compiler, > but > there are no guidelines as to its use in the coding conventions (to the > extent > they need to be in there). > > I propose the following, based on Thiago's proposal from

Re: [Development] RFF: nullptr rules

2015-12-09 Thread Sergio Martins
On Wednesday, 9 December 2015 16:14:00 WET Marc Mutz wrote: > Arguments in favour: > - it's the C++ way of writing the null pointer constant these days > - we need to use it in headers, anyway, to allow people to use -Wzero-as..., > and it makes no sense to have two sets of rules for headers and i

[Development] RFF: nullptr rules

2015-12-09 Thread Marc Mutz
Hi, in 5.7, nullptr (Q_C_NULLPTR) is required to be supported by the compiler, but there are no guidelines as to its use in the coding conventions (to the extent they need to be in there). I propose the following, based on Thiago's proposal from January this year, considering the new situation