From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: CC Mode and electric-pair "problem". Date: Tue, 19 Jun 2018 01:07:36 +0700 Message-ID: References: <20180531123747.GA24752@ACM> <20180617201351.GA4580@ACM> <20180618103654.GA9771@ACM> <20180618154227.GB3973@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1529345196 24265 195.159.176.226 (18 Jun 2018 18:06:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2018 18:06:36 +0000 (UTC) Cc: Alan Mackenzie , Emacs developers , Tino Calancha , Glenn Morris To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 18 20:06:32 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fUyXv-0006Al-VU for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2018 20:06:32 +0200 Original-Received: from localhost ([::1]:36371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUya1-00025U-35 for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2018 14:08:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUyZF-000256-NI for emacs-devel@gnu.org; Mon, 18 Jun 2018 14:07:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUyZE-0001aB-Iy for emacs-devel@gnu.org; Mon, 18 Jun 2018 14:07:53 -0400 Original-Received: from mail-oi0-x233.google.com ([2607:f8b0:4003:c06::233]:38573) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUyZC-0001Zf-Vd; Mon, 18 Jun 2018 14:07:51 -0400 Original-Received: by mail-oi0-x233.google.com with SMTP id d5-v6so15683367oib.5; Mon, 18 Jun 2018 11:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Jt9PsnWaHWad7AqsWR4xWHrReFVY4Z4EiHlx47cl/Kc=; b=V4nceywXwvRNqG5f0DfM7m3ZJ/Mrm+b66FdYdCwdIPTzzRrrtOK2eDQvIVQP+sqz5R 90GF0V8e1Ki3Kaz45xDxfpPdvDtlnK1bkLc1M6j3dmxcgtrREHD/HsQiJTVNIka0mPln GEqQoF7nzvd8rsZclE2GPdHFJXNDBJjhwhDJ92niwwpCqT3K9YKh1YloglpSlbswnA4N TUKNxMsfAnMgAjhX9pGh/AW+md3cMqBgACiJLkAMf6oEs51uve+n+lioW+dSI2k0yDui VSCQyBDcWt50DZSOwUv9yB8hq3MrkRSzI7gQVfFERj40FTwMZr5B6UztmfIOXtOh4hlL T/3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Jt9PsnWaHWad7AqsWR4xWHrReFVY4Z4EiHlx47cl/Kc=; b=WAcah7kC6U//P6q1q4bJ0JMku4yekKKlbkPkjo/YUySwJl3NGINBQo1YKyC0ywqcY4 6i2EhmdLtzluvtOWYsWN5EwjkhsdIJH5MXD24zH6mv9R65oic1Tbj0PaM4Ci3mTSoqUX jz4Uhrv883LeqtYm+UyIl0MIJ3HvgiqaeV6eHDYxl3qB99dQN5A4WTkShUj/8ty3HAYc b0LF2TB2y6f1DRifQUv01OGpRardjxDG/nAibCJha8UVi+cACcwzguHhCLgitf+ZbQR0 TjkViUJSj73Sx0eep3bgrehYeE6z+uuGI//YargFcw1WR4uwjM+8B04FTX9Hri5VsRJD clfA== X-Gm-Message-State: APt69E2LtFSLyPWMDtxoQu1x335fu5QIUHSB/yk1Z1TxRJonuh2pf4O9 2aN+jFlF89/Y/0qtgEOT8aVS7JF3yyEGsxQL8S4= X-Google-Smtp-Source: ADUXVKLwtBiRYy2+9TSlG514BU6Sr4PVVZXPQYj8UH7GPAkkn7OPZnlgV4FUbZ8tj3liMiwmcKKP7onH5+IfBRdK6JE= X-Received: by 2002:aca:c141:: with SMTP id r62-v6mr7038990oif.68.1529345270270; Mon, 18 Jun 2018 11:07:50 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226471 Archived-At: On Tue, Jun 19, 2018 at 12:25 AM Jo=C3=A3o T=C3=A1vora wrote: > Alan Mackenzie writes: > > Why? They are now C statements, and would be handled by the compiler a= s > > such. > > Clarify "would". Because this doesn't compile. My compiler doesn't even > seem to look at anything after the unterminated string: > > int main () { > printf("foo > ); > printf("bar"); > return 0; > } Mine does. After finding a syntax error, a typical C compiler continues scanning the source, attempting to diagnose more errors. See: ``` int main() { printf("foo ); return baz; } $ gcc test1.c test1.c: In function =E2=80=98main=E2=80=99: test1.c:2:5: warning: implicit declaration of function =E2=80=98printf=E2= =80=99 [-Wimplicit-function-declaration] printf("foo ^ test1.c:2:5: warning: incompatible implicit declaration of built-in function =E2=80=98printf=E2=80=99 test1.c:2:5: note: include =E2=80=98=E2=80=99 or provide a declara= tion of =E2=80=98printf=E2=80=99 test1.c:2:12: warning: missing terminating " character printf("foo ^ test1.c:2:5: error: missing terminating " character printf("foo ^ test1.c:2:5: error: too few arguments to function =E2=80=98printf=E2=80=99 test1.c:4:12: error: =E2=80=98baz=E2=80=99 undeclared (first use in this fu= nction) return baz; ^ test1.c:4:12: note: each undeclared identifier is reported only once for each function it appears in ``` Observe that the compiler first complains about the unclosed string literal, then too few arguments, and then undeclared identifier =E2=80=98ba= z=E2=80=99. If the compiler thought the string terminal continued, it would skip everything until the end of file silently. Now add a few characters: ``` int main() { printf("foo "bar"); return baz; } $ gcc test2.c test2.c: In function =E2=80=98main=E2=80=99: test2.c:2:5: warning: implicit declaration of function =E2=80=98printf=E2= =80=99 [-Wimplicit-function-declaration] printf("foo ^ test2.c:2:5: warning: incompatible implicit declaration of built-in function =E2=80=98printf=E2=80=99 test2.c:2:5: note: include =E2=80=98=E2=80=99 or provide a declara= tion of =E2=80=98printf=E2=80=99 test2.c:2:12: warning: missing terminating " character printf("foo ^ test2.c:2:5: error: missing terminating " character printf("foo ^ test2.c:4:12: error: =E2=80=98baz=E2=80=99 undeclared (first use in this fu= nction) return baz; ^ test2.c:4:12: note: each undeclared identifier is reported only once for each function it appears in ``` Observe the compiler no longer complains about too few arguments to =E2=80=98printf=E2=80=99. This is consistent with the hypothesis that it di= scarded the unterminated literal at the newline, and took "bar" as the required format string argument.