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:17:43 -0700 Organization: None to speak of Lines: 32 Message-ID: References: <11edbfd7-461d-4579-8ac7-a9e84a6b7630@googlegroups.com> <7b110d3e-ddb5-42a0-af99-aa5b0cb30832@googlegroups.com> <13efc313-d10c-4357-9aa7-6fa55b09d948@googlegroups.com> <87po1xi2n1.fsf@bsb.me.uk> 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="U2FsdGVkX19mdR9x6w6FXx6+FCwkoQbl" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:YbKMaiJ+MH8lDPXvsV0G9269O1U= sha1:fqBn2gFYyMFGME/1KzYZ63i/4g4= Xref: csiph.com comp.lang.c:130613 bartc writes: > On 15/05/2018 12:23, Ben Bacarisse wrote: >> bartc writes: > >> A lot of your objections to c might come down to the fact that you think >> of programming language constructs as doing thing rather than meaning >> things. > > Yes, in this case both generate the same output: > > &"abc"; > "abc"; > > leads to this code (using my compiler): > > mov D0, KK1 # KK1/2 are labels of the string data > mov D0, KK2 # both are 64-bit pointer loads Assembly code does not define the semantics of C code. C code ultimately specifies run-time behavior. The machine code output of a compiler is an implementation detail meant to accomplish that behavior. char *p0 = "abc"; /* This is legal */ char *p1 = &"abc"; /* This is a constraint violation */ -- 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"