Skip to content

Emulate an integer safety profile #176

@mborland

Description

@mborland

We should be able to emulate an integer safety profile doing something like this:

#include <cstdint>
#include <boost/safe_numbers.hpp>

#ifndef BOOST_SAFE_NUMBERS_INTEGER_SAFETY_PROFILE

namespace not_std {

Using uint8_t = std::uint8_t;
Using uint16_t = std::uint16_t;
...

}

#else

Namespace not_std {

Using uint8_t = boost::safe_numbers::u8;
Using uint16_t = boost::safe_numbers::u16;

}

#endif 

And then we can write out an example where the example compiles with or without the safety profile, but the actual result is different because a real error was caught.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions