[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: groff with "nullptr" and (without) gnulib module causes error
From: |
Jeffrey Walton |
Subject: |
Re: groff with "nullptr" and (without) gnulib module causes error |
Date: |
Wed, 8 Feb 2023 17:23:02 -0500 |
On Wed, Feb 8, 2023 at 2:24 PM Bjarni Ingi Gislason <bjarniig@simnet.is> wrote:
> [...]
> Build with gnulib nullptr module or without it causes
>
> CXX src/roff/troff/input.o
> ../src/roff/troff/input.cpp: In member function 'void token::next()':
> ../src/roff/troff/input.cpp:2078:18: error: invalid operands of types 'const
> char' and 'std::nullptr_t' to binary 'operator!='
> 2078 | if (*p != nullptr || s.is_empty()) {
> | ~~~^~~~~~~~~~
> make[1]: *** [Makefile:10126: src/roff/troff/input.o] Error 1
> make[1]: Leaving directory '/home/bg/git/groff/build'
> make: *** [Makefile:6847: all] Error 2
This looks like a problem with the code. I think the code should have used:
if (*p != '\0' || s.is_empty()) {
But I may be mistaken. NULL can be a literal 0 (nullptr cannot), so it
might be Ok to write:
if (*p != NULL || s.is_empty()) {
But I think '\0' is more correct since you are concerned with a
character value, and not a pointer value.
Jeff