C++11 – Enumeration Aliasing

M

molw5.iwg

Recently I've been using C++11 enumerations to provide a byte pointer with
stronger strict-aliasing properties. Specifically, I've been using the
definition:

enum byte : uint8_t {};

My reading of the strict-aliasing rules supports the behaviour modern compilers
exhibit in this regard; specifically, byte* aliases only other byte pointers and
raw character points. I'm looking for a second opinion here with respect to the
strict-aliasing rules – additionally, I'd like to know if I'm implicitly relying
on any undefined or implementation-specific behaviour here I may have overlooked.
Thanks in advance,

-molw5
 
M

molw5.iwg

Recently I've been using C++11 enumerations to provide a byte pointer with

stronger strict-aliasing properties. Specifically, I've been using the

definition:



enum byte : uint8_t {};



My reading of the strict-aliasing rules supports the behaviour modern compilers

exhibit in this regard; specifically, byte* aliases only other byte pointers and

raw character points. I'm looking for a second opinion here with respectto the

strict-aliasing rules – additionally, I'd like to know if I'm implicitly relying

on any undefined or implementation-specific behaviour here I may have overlooked.

Thanks in advance,



-molw5

Wrong forum, apologies :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top