On Fri, Dec 14, 2007 at 08:30:59PM +0000, Ted Kremenek wrote:
> Does anyone have any insights on the semantics of expressions of the
> form sizeof(sizeof(...))? For example, the following is legal code:
>
> int baz(int x) {
> typedef int a[f()];
> return sizeof (sizeof(a[bar(x)]));
> + sizeof(sizeof(x));
> }I don't get the reason why someone would do that, but afaict sizeof is a size_t (not an unsigned int) so sizeof(sizeof(a[bar(x)])) is just sizeof(size_t). I don't have my C norm at hand, but at least gcc believes that sizeof "returns" a size_t since its printf format checker complains if I use "%d" and definitely wants "%zd". -- ·O· Pierre Habouzit ··O [EMAIL PROTECTED] OOO http://www.madism.org
pgpuExbeiLk29.pgp
Description: PGP signature
_______________________________________________ cfe-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
