No adhering to ISO C++
pmor13 opened this issue · 4 comments
pmor13 commented
The elfio.pdf says:
Adhering to ISO C++
Well, ISO C++ does not have strnlen
.
Hence an ISO C++ compiler (e.g. g++ -std=c++17
) won't build ELFIO:
./elfio/elfio_strings.hpp: In instantiation of ‘const char* ELFIO::string_section_accessor_template<S>::get_string(ELFIO::Elf_Word) const [with S = ELFIO::section; ELFIO::Elf_Word = unsigned int]’:
./elfio/elfio.hpp:521:54: required from here
./elfio/elfio_strings.hpp:49:28: error: ‘strnlen’ was not declared in this scope; did you mean ‘strlen’?
49 | strnlen( data + index, string_section->get_size() - index );
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| strlen
serge1 commented
Hi,
The function is not a part of C++ standard, but, it is a part of POSIX.
I was not able to get this error when using the following command line:
g++-12 -std=c++17 -Wall -Wextra -pedantic -Werror -I../.. elfdump.cpp -o elfdump
The library was checked by g++, clang++ and MSVS C++ compilers on Intel processors.
What processor architecture you compile for?
In GNU header file string.h, availability of strnlen()
is managed by define __USE_XOPEN2K8
.
Please see dedicated thread at StackOverflow
serge1 commented
Due to no activity, I'm closing the issue. Feel free to reopen if required.
pmor13 commented
Consider avoiding extensions. An ISO C++ compiler is not required to
support extensions.
…On Sun, Jul 23, 2023, 3:58 PM Serge Lamikhov-Center < ***@***.***> wrote:
Closed #122 <#122> as completed.
—
Reply to this email directly, view it on GitHub
<#122 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDAC232KM5SOND6RNOIIZTXRUNX5ANCNFSM6AAAAAAXO7YAOI>
.
You are receiving this because you authored the thread.
Message ID: ***@***.***>