Topic: C++11 Enumeration Aliasing


Author: molw5.iwg@googlemail.com
Date: Mon, 25 Feb 2013 11:00:36 CST
Raw View
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


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]