Hi, all. In re-submitting a package to CRAN, I'm getting the following
warnings in the Debian pre-test:
Found the following significant warnings:
sort.cpp:12:28: warning: binary constants are a C++14 feature or GCC extension
sort.cpp:12:43: warning: binary constants are a C++14 feature or GCC extension
I added some C++ code to speed up the package and the warnings refer to
this line of C++:
while ((s[p + length] & 0b11000000) == 0b10000000) {
The line has to do with parsing UTF-8 strings by figuring out how many
bytes are used in each character. Is the 0b... notation not allowed in
CRAN? I could substitute decimal constants, but that will be a bit more
obtuse. The other platforms seems to allow this; only the Debian check
failed.
Dan
.
--------------------------
Dan Zigmond
djz at shmonk.com
[R-pkg-devel] warning: binary constants are a C++14 feature or GCC extension
3 messages · Dan Zigmond, David Kepplinger
Dear Dan, As the warning says, the binary notation you use is only valid with C++14 and onwards. You can either add SystemRequirements: C++14 to your DESCRIPTION file, or use decimal (or hex) notation. In my opinion it's even better to name your constants to convey their meaning to the reader of the code. Then it wouldn't be a big issue if you use binary, decimal, or hex notation. Best, David
On Sat, Nov 21, 2020 at 4:59 PM Dan Zigmond <djz at shmonk.com> wrote:
Hi, all. In re-submitting a package to CRAN, I'm getting the following
warnings in the Debian pre-test:
Found the following significant warnings:
sort.cpp:12:28: warning: binary constants are a C++14 feature or GCC extension
sort.cpp:12:43: warning: binary constants are a C++14 feature or GCC extension
I added some C++ code to speed up the package and the warnings refer to
this line of C++:
while ((s[p + length] & 0b11000000) == 0b10000000) {
The line has to do with parsing UTF-8 strings by figuring out how many
bytes are used in each character. Is the 0b... notation not allowed in
CRAN? I could substitute decimal constants, but that will be a bit more
obtuse. The other platforms seems to allow this; only the Debian check
failed.
Dan
.
--------------------------
Dan Zigmond
djz at shmonk.com
[[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
David Kepplinger, PhD https://www.dkepplinger.org
Thank you! That's very helpful.
Dan
.
--------------------------
Dan Zigmond
djz at shmonk.com
On Sat, Nov 21, 2020 at 5:14 PM David Kepplinger <david.kepplinger at gmail.com>
wrote:
Dear Dan, As the warning says, the binary notation you use is only valid with C++14 and onwards. You can either add SystemRequirements: C++14 to your DESCRIPTION file, or use decimal (or hex) notation. In my opinion it's even better to name your constants to convey their meaning to the reader of the code. Then it wouldn't be a big issue if you use binary, decimal, or hex notation. Best, David On Sat, Nov 21, 2020 at 4:59 PM Dan Zigmond <djz at shmonk.com> wrote:
Hi, all. In re-submitting a package to CRAN, I'm getting the following warnings in the Debian pre-test: Found the following significant warnings: sort.cpp:12:28: warning: binary constants are a C++14 feature or GCC
extension
sort.cpp:12:43: warning: binary constants are a C++14 feature or GCC
extension
I added some C++ code to speed up the package and the warnings refer to
this line of C++:
while ((s[p + length] & 0b11000000) == 0b10000000) {
The line has to do with parsing UTF-8 strings by figuring out how many
bytes are used in each character. Is the 0b... notation not allowed in
CRAN? I could substitute decimal constants, but that will be a bit more
obtuse. The other platforms seems to allow this; only the Debian check
failed.
Dan
.
--------------------------
Dan Zigmond
djz at shmonk.com
[[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
-- David Kepplinger, PhD https://www.dkepplinger.org