Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Pointer conversion and alignment Date: Mon, 17 Dec 2018 12:35:25 -0800 Organization: None to speak of Lines: 32 Message-ID: References: <20181117143819.43938ee34006bbcc1826bf0c@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="b404aef90da6b83638d2f6ac3cfb5ea7"; logging-data="26941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kt9TnGw42TV39UAvBt57s" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:D8dfYtoWBU9XxQiOySLxGEuXKQw= sha1:jECkXmt07PCdANSZ8hw9c96EnJU= Xref: csiph.com comp.lang.c:138717 Tim Rentsch writes: [...] > Fifth, therefore, it is always possible to determine whether a > pointer value is suitably aligned, by looking at the bits - > because the encoding is implementation-defined, we can determine > which address the pointer holds, which tells us the alignment. [...] Where does the standard say that pointer representation is implementation-defined? 6.2.6.1p1 says: The representations of all types are unspecified except as stated in this subclause. Pointer types are not mentioned in the remainder of 6.2.6. (I just noticed what I think is a minor flaw, not relevant to my question above. The phrase "this subclause" *should* refer to 6.2.6, but it appears in 6.2.6.1.) Of course "unspecified" is consistent with "implementation-defined", but I don't see anything that requires the implementation to document its pointer representation. (Conversions between pointers and integers have implementation-defined results, but that doesn't imply that pointer representation must be documented.) -- Keith Thompson (The_Other_Keith) kst@mib.org Will write code for food. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"