Page 1 of 1
C++ 17 and byte
Posted: Sun Nov 08, 2020 5:08 pm
by IXix
C++ 17 implements
std::byte so if I do "using namespace std" it clashes with the byte typedef in MachineInterface.h and I get all kinds of compiler errors.
Is there any way to fix this that doesn't involve me prefixing every one of the bazillion strings/vectors/maps/sets and god knows what else in my project with "std::"?
Re: C++ 17 and byte
Posted: Mon Nov 09, 2020 7:39 am
by oskari
You can comment out 'typedef unsigned char byte' in MachineInterface.h, #include <cstddef> and change references to byte to std::byte in the file.
Or if you don't want to modify the file you can do
Code: Select all
namespace Buzz
{
#include "MachineInteface.h"
}
and use Buzz::CMachineInterface etc.
Re: C++ 17 and byte
Posted: Mon Nov 09, 2020 9:38 am
by IXix
oskari wrote: ↑Mon Nov 09, 2020 7:39 am
You can comment out 'typedef unsigned char byte' in MachineInterface.h, #include <cstddef> and change references to byte to std::byte in the file.
Or if you don't want to modify the file you can do
Code: Select all
namespace Buzz
{
#include "MachineInteface.h"
}
and use Buzz::CMachineInterface etc.
Thanks Oskari. One question though, std::byte is an enum class (which is still a new thing for me
) so is that compatible with the simple unsigned char byte that we know and love?
Re: C++ 17 and byte
Posted: Wed Nov 11, 2020 9:26 am
by IXix
IXix wrote: ↑Mon Nov 09, 2020 9:38 amis that compatible with the simple unsigned char byte that we know and love?
Duh, brain fail.