From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 14 Jul 2009 12:38:22 -0400 To: a.verardo@tecmav.com, 9fans@9fans.net Message-ID: <83849e7a0112eb8132650c2b76fa3dea@coraid.com> In-Reply-To: <4A5CB1C2.2000805@tecmav.com> References: <4A5C8F93.6090603@tecmav.com> <7144845a3c658a8194be95e64d69486f@coraid.com> <4A5CB1C2.2000805@tecmav.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] C compiler question Topicbox-Message-UUID: 204b8fc2-ead5-11e9-9d60-3106f5b1d025 > erik quanstrom wrote: > >> The point is how to compute the offset(s) of the last field at compile / > >> run time. > >> > > > > the offset of the last field is not in question. i believe you mean the size? > > > It's really the same info. it is not. the size and offset are different things. > offset(B) = 100, &(A.B[7]) == address(A) + 100 + 7*sizeof(int). > The compiler accept the dirty but legal expression A.B[-3] because it > can compute > the address (or the offset with respect the beginnig of "A") of the B > "-3" cell. this is completely beside the point and furthermore the sizeof A.B never enters into the picture. - erik