[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #62398] .../troff/input.cpp: argument "len" is zero in "new unsigne
From: |
Dave |
Subject: |
[bug #62398] .../troff/input.cpp: argument "len" is zero in "new unsigned char[len]" |
Date: |
Sun, 22 May 2022 20:36:07 -0400 (EDT) |
Follow-up Comment #4, bug #62398 (project groff):
[comment #2 comment #2:]
> It sounds like this non-default compiler warning does not
> indicate the presence of incorrect program operation.
My question in comment #1 was genuine--I don't know what C++ guarantees in
this situation.
[comment #3 comment #3:]
> The "new" operator (with len = 0) creates a pointer that
> points to a "NULL" (nullptr) in the memory.
>
> This can be seen when output is inserted to the code, for example
That tells us what one compiler on one platform does, which is of limited
usefulness for a package that needs to compile in multiple environments.
If the C++ standard says this is the defined behavior, then the proposed
replacement code is functionally equivalent to the existing code.
If the standard leaves this behavior undefined, then there's a problem with
the existing code.
If the standard defines the behavior but some compiler is known to be
noncompliant, that's a different problem--arguably not ours.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62398>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/