
18 Mar
2008
18 Mar
'08
4:56 p.m.
AMDG Phil Bouchard wrote:
- I have changed the code for the following: ((T *)(alignment_of<detail::max_align>::value)->* q)
How is that better?
Well I anticipate certain compilers will report a warning or even an error when faced with a null pointer being dereferenced.
Which compilers? IMO, you shouldn't make the code even more obscure until it's known for certain to be a problem.
This address dissosiates the pointer from an undefined behavior and is aligned for all types.
5.5/4: "If the dynamic type of the object does not contain the member to which the pointer refers, the behavior is undefined." In Christ, Steven Watanabe