A C++ question

"xue_mei_he" <[email protected]> Wed, 28 Jun 2006 13:52:25 -0000
Newsgroups gmane.comp.programming.cppug
Message-ID <[email protected]>
I saw some code in ACE:

class ACE_Export ACE_U_LongLong
{
   ....
   ....

union
      {
        struct
          {
#     if defined (ACE_BIG_ENDIAN)
            /// High 32 bits.
            ACE_UINT32 hi_;

            /// Low 32 bits.
            ACE_UINT32 lo_;
#     else
            /// Low 32 bits.
            ACE_UINT32 lo_;

            /// High 32 bits.
            ACE_UINT32 hi_;
#     endif /* ! ACE_BIG_ENDIAN */

          } data_;

        /// To ensure alignment on 8-byte boundary.
        /**
         * @note "double" isn't usually usable with
         *       ACE_LACKS_FLOATING_POINT, but this seems OK.
         */
        double for_alignment_;
      };
   ....
};

I don't understand why for_alignment_ can ensure aligment on 8-byte 
boundary. Anyone can tell me?

Thanks!

ChinaGirl from Canada





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cppug/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/