[Top][All Lists]

[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: G. Branden Robinson
Subject: [bug #62398] .../troff/input.cpp: argument "len" is zero in "new unsigned char[len]"
Date: Fri, 7 Apr 2023 12:45:09 -0400 (EDT)

Update of bug #62398 (project groff):

                  Status:                    None => Ready for Merge        
             Assigned to:                    None => gbranden               


Follow-up Comment #10:

commit c09128d9ef8c8181e61614ae762308d2ac27b29f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Mon Apr 3 19:30:56 2023 -0500

    [troff]: Skip allocation of zero-length arrays.
    * src/roff/troff/input.cpp (temp_iterator::temp_iterator): Skip
      allocation of zero-length arrays.  Resolves "-Walloc-zero" warning
      from GCC.
    Fixes <https://savannah.gnu.org/bugs/?62398>.  Thanks to Bjarni Ingi
    Gislason for the report.
    It is not necessary to make conditional the subsequent `delete[]` of a
    null pointer.  "If the _delete-expression_ calls the implementation
    deallocation function (, and if the operand of the delete
    expression is not null pointer constant, the deallocation function will
    deallocate the storage referenced by the pointer thus rendering the
    pointer invalid" (ISO/IEC 14882-1998, ยง5.3.5, paragraph 4).  Or as
    Stroustrup puts it, "Applying _delete_ to zero has no effect." (_The C++
    Programming Language, Special Edition_, p. 128).


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]