Skip to content

Figure out which data type to use for representation of binary data in C++ #1079

@ComicSansMS

Description

@ComicSansMS

iceoryx2 uses C++14 for its C++ code parts. That means we are missing an equivalent of std::byte for representing binary data that should not be interpreted as an integral value. We currently use char as the type there, but we may want to use something more robust here.

  • stick with char or unsigned char as they get the job done
  • C++17 byte can be emulated reasonably well by the typedef enum class byte : unsigned char {};, but it needs to be verified that this works as expected on all supported C++14 compilers.
  • iceoryx-hoofs uses the following type for this
template <typename ElementType>
struct alignas(ElementType) Element {
    char data[sizeof(ElementType)];
};

Element<Foo> buffer[13];

which mixes in concerns of alignment and size that are not part of the initial design of std::byte

The goal of this issue is to discuss these and other approaches along with their trade offs and come to a design decision that is applicable to all C++ parts of iceoryx2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions