[asterisk-dev] [asterisk-commits] wdoekes: trunk r343163 - in /trunk: ./ include/asterisk/ main/

Kevin P. Fleming kpfleming at digium.com
Wed Nov 2 18:10:38 CDT 2011


On 11/02/2011 05:02 PM, SVN commits to the Asterisk project wrote:

> -	char base[0];				/*!<  storage space for the fields */
> +	char base[0] __attribute__((aligned(sizeof(ast_string_field_allocation)))); /*!<  storage space for the fields */

Sorry I didn't get to this while it was still on ReviewBoard; I agree 
with these changes, they are the right thing to do. The only additional 
comment that I would make is that I would prefer to use 
"alignof(ast_string_field_allocation)" instead of 
"aligned(sizeof(...))". This allows the compiler to tell you how an 
instance of that type should be aligned, which *might* not be on a 
boundary the same as its size. Granted, for all common platforms the 
alignment of a 2-byte integer is also 2 bytes... but it's conceivable 
that some platform might want to align 2-byte integers on 4-byte 
boundaries in the future.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list