From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.43.1.138 with SMTP id nq10mr4481284icb.17.1414000545611; Wed, 22 Oct 2014 10:55:45 -0700 (PDT) X-Received: by 10.140.96.163 with SMTP id k32mr23981qge.33.1414000545472; Wed, 22 Oct 2014 10:55:45 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!uq10no15722546igb.0!news-out.google.com!u5ni1qab.1!nntp.google.com!k15no112798qaq.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 22 Oct 2014 10:55:44 -0700 (PDT) In-Reply-To: <1cc7dace-72d5-46c7-9e32-b4b857997ef7@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.229.110.218; posting-account=wEPvUgoAAABrLeiz_LRhQ3jeEhyfWVMH NNTP-Posting-Host: 71.229.110.218 References: <7c1b89e6-9ab8-4faa-b60c-c5c4683f0bff@googlegroups.com> <87d29kfwip.fsf@ludovic-brenta.org> <1cc7dace-72d5-46c7-9e32-b4b857997ef7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3b22222a-bde7-4afb-bdd7-8242ef66d6a7@googlegroups.com> Subject: Re: Assembling Complex Strings Containing Carriage Returns Prior to Using Ada.Text_IO.Put? From: NiGHTS Injection-Date: Wed, 22 Oct 2014 17:55:45 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:22674 Date: 2014-10-22T10:55:44-07:00 List-Id: On Wednesday, October 22, 2014 1:32:29 PM UTC-4, Adam Beneschan wrote: > On Tuesday, October 21, 2014 11:28:48 PM UTC-7, Ludovic Brenta wrote: > > > > > '\n' is not ASCII.CR, it is ASCII.LF, by the way. And on some > > > nonstandard platforms, the C compiler translates '\n' into a sequence of > > > two characters, ASCII.CR & ASCII.LF. > > > > Only when the character is processed for output, I think (to standard output or to a file). Is there really a C compiler which will output 5 for this? > > > > char str[] = "abc\n"; > > printf("%d\n", strlen(str)); > > > > -- Adam I can make a C compiler right now that will output 5 for that. But I believe the standard for a non wide string escape character is that it occupies one byte of memory since the standard describes "char" as being one byte wide. It would not surprise me if printf() would indirectly process \n as \x0A\x0D, perhaps via the stream target driver (stdout). I don't think printf() itself would be written to interpret this character as a two byte in itself.