Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C++ features for C Date: Tue, 15 May 2018 09:12:49 -0700 Organization: None to speak of Lines: 25 Message-ID: References: <11edbfd7-461d-4579-8ac7-a9e84a6b7630@googlegroups.com> <7b110d3e-ddb5-42a0-af99-aa5b0cb30832@googlegroups.com> <13efc313-d10c-4357-9aa7-6fa55b09d948@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="fd2ef88f3973fbdcdd5cf6f7f328cfd4"; logging-data="9601"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AU2EKgc3AKahV2hrfo+Al" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Fr3c8IVUQIPVrg3EnTckbCy6/5Q= sha1:Le8VNF0q7pWrghWYsMxB/pfqOMY= Xref: csiph.com comp.lang.c:130611 bartc writes: [...] > (** There is an odd exception in being able to apply & to string > literals, although &"abc" and "abc" do the same thing. "abc" already > results in the address of a location where "abc" is stored, an address > which doesn't itself have any location, so that & of that address is > meaningless. But it works because & is applied before that address is > derived.) No, &"abc" and "abc" are not equivalent. &"abc" yields a pointer value of type char(*)[4]. "abc" is an lvalue of type char[4]; when used in a context that invokes an array-to-pointer conversion, it yields a pointer value of type char*. Both pointer values refer to the same location, but they're of different types. Come one, bart, you know this stuff. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"