On Fri, Apr 20, 2012 at 8:41 PM, Jay Foad <[email protected]> wrote: > On 20 April 2012 16:54, Martin Jambor <[email protected]> wrote: >> two days ago I talked to Richi on IRC about the functions to determine >> the expected alignment of objects and pointers we have and he >> suggested that get_object_alignment_1 and get_pointer_alignment_1 >> should return whether the alignment is actually known > > Can you explain how returning "unknown" is different from returning > some minimal known alignment? Comments like: > >> ! /* Compute values M and N such that M divides (address of EXP - N) and >> ! such that N < M. Store N in *BITPOSP and return M. > > suggest that M=1, N=0 is always a valid conservative thing to return. > > If there is a difference, the comment should explain what it means.
Well. The difference is for 2nd level code such as get_object_or_type_alignment which should not override explicitely known misalginment (the user typed *(int *)( (char *)&intvar + 1)) with alignment derived from types (the C standard says that code invokes undefined behavior, but doing what the user means is certainly what we can do and what people expect from a QOI point of view). Richard. > Thanks, > Jay.
