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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top