This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [wwwdocs] Add common C++ issues to /gcc-6/porting_to.html


On 03/02/16 19:47 +0100, Jakub Jelinek wrote:
On Wed, Feb 03, 2016 at 10:42:37AM -0800, Mike Stump wrote:
On Feb 3, 2016, at 9:13 AM, David Malcolm <dmalcolm@redhat.com> wrote:
>> +pointer constants, so other constants such as <code>false</code> and
>> +<code>(1 - 1)</code> cannot be used where a null pointer is desired.

So, Iâd leave this out entirely.  The subject is porting, not the fine detail pedanticism only a language lawyer could love.  Was this text from a porting experience, or an invention based upon compiler/language mods?

I believe trying to use false as pointer is from porting experience,
(1 - 1) most likely not really used in the wild, but just clarifies what is
and what is not the null pointer constant.

Yes, there are *dozens* of packages that fail to build due to "return
false;" in a function that returns a pointer of some kind.

I can't imagine what the authors of that code were thinking, if they
were thinking, or what was wrong with "return NULL;" or "return 0;"
but it compiled in C++98 so apparently people did it.  It doesn't
compile in C++11, so I added it tothe page. The pedantic details of
which standard (or DR) changed the rules matter much less than the
fact the rules changed.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]