Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #126818

Re: Text Files

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Text Files
Date Fri, 16 Feb 2018 15:14:45 -0800
Organization None to speak of
Lines 58
Message-ID <lnsha0o7bu.fsf@kst-u.example.com> (permalink)
References <5a8459d1$0$707$14726298@news.sunsite.dk> <87mv0b9ocq.fsf@bsb.me.uk> <p63lup$l42$2@dont-email.me> <61abd898-60fc-4290-823a-a7ddd264700e@googlegroups.com> <p64768$gpj$1@dont-email.me> <TBihC.260036$w26.87474@fx47.am4> <p64qnr$b5q$1@dont-email.me> <zRmhC.24616$Dt.19656@fx18.am4> <p6673c$7j6$1@dont-email.me> <nyAhC.85999$Ii5.20344@fx19.am4> <0c04c390-ed12-4844-95d4-1790cee90c33@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader02.eternal-september.org; posting-host="6f83efc23bf5f10533d14661db20aa68"; logging-data="4756"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18acm8dS0xGwR65kd49TJ+g"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:ZrQjT+lvP3jZBuL+LAz/HKi0MFw= sha1:0pJnT7aS4HWEBAYUObp9xxwphAg=
Xref csiph.com comp.lang.c:126818

Show key headers only | View raw


supercat@casperkitty.com writes:
> On Friday, February 16, 2018 at 6:57:06 AM UTC-6, Bart wrote:
>> I gave an example before of where an older language of mine (one of 
>> those involved above), statically typed like C, could do exactly this:
>> 
>>      int a,b,c,d,e,f
>>      readln #file, a,b,c,d,e,f
>> 
>> There is no reason why C couldn't do exactly the same. Then it could be 
>> used for quick throwaway programs just as easily as any other language.
>
> A compiler using a purpose-designed library could probably generate code
> to handle variadic arguments that was type-safe while being, in many
> typical scenarios, more compact than what a C compiler would generate.
> Given something like
>
>     WriteLn('The values are x=', x, ' and y=', y, '.);
>
> a compiler could generate code equivalent to:
>
>     {
>       char writeLnSpec8675309[] = {...};
>       WriteLn(writeLnSpec8675309);
>     }
>
> where writeLnSpec8675309 would encode information about the types and
> addresses of the objects to be printed as well as any format specifiers.
> Such information could in many cases be more compact than the instructions
> that would be needed to push the values in question onto the stack.

Perhaps -- but what if you want more than one way to format a value of a
given type?

C provides multiple ways to format integer values on output.  You can
control the base, field width, leading zeros, etc.  The cost is a lack
of type safety (though compilers can do some checking *if* the format
string is a literal).

C++ is simpler for simple cases, but the standard way to change how
values are formatted changes the state of the output stream.  Print one
integer in hexadecimal, and all following integers are printed in
hexadecimal unless you explicitly reset the state.

I have some vague thoughts about better approaches, but they wouldn't be
topical.

> The biggest problem with such an approach would be defining a means of
> indicating what things were passed that would promote compatibility among
> different tools, and yet lead to efficient code.  Having the first thing
> in each argument spec be a pointer to a descriptor which contains a
> table of functions to examine arguments would be good for compatibility,
> but add extra overhead.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
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"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Text Files G B <gb@gb.com> - 2018-02-14 11:47 -0400
  Re: Text Files Ed Prochak <edprochak@gmail.com> - 2018-02-14 08:45 -0800
  Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-14 08:47 -0800
    Re: Text Files already5chosen@yahoo.com - 2018-02-15 01:17 -0800
  Re: Text Files gordonb.ea2mq@burditt.org (Gordon Burditt) - 2018-02-14 11:10 -0600
  Re: Text Files "James R. Kuyper" <jameskuyper@verizon.net> - 2018-02-14 12:28 -0500
  Re: Text Files jt@toerring.de (Jens Thoms Toerring) - 2018-02-14 21:07 +0000
  Re: Text Files Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-14 15:31 -0700
    Re: Text Files Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-15 06:59 +0000
      Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 10:20 +0000
  Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-14 22:51 +0000
    Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-15 11:04 +0100
      Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-15 06:16 -0800
        Re: Text Files "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-02-15 22:22 +0800
        Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-15 15:58 +0100
          Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 16:31 +0000
            Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-15 21:31 +0100
              Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 21:21 +0000
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 22:17 +0000
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 23:36 +0000
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 23:48 +0000
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 10:09 +0100
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 12:57 +0000
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 15:50 +0100
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 15:50 +0000
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 17:07 +0100
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 20:44 +0000
                Re: Text Files Ian Collins <ian-news@hotmail.com> - 2018-02-17 11:22 +1300
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 17:48 +0000
                Re: Text Files GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-16 17:06 +0100
                Re: Text Files Ian Collins <ian-news@hotmail.com> - 2018-02-17 11:10 +1300
                Re: Text Files supercat@casperkitty.com - 2018-02-16 14:48 -0800
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-16 15:14 -0800
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 23:25 +0000
                Re: Text Files supercat@casperkitty.com - 2018-02-16 15:50 -0800
          Re: Text Files already5chosen@yahoo.com - 2018-02-16 07:19 -0800
            Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 17:13 +0100
              Re: Text Files Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-19 17:55 +0000
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-19 19:14 +0100
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-19 11:48 -0800
            Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-16 08:14 -0800
              Re: Text Files Robert Wessel <robertwessel2@yahoo.com> - 2018-02-17 18:32 -0600
    Re: Text Files jacobnavia <jacob@jacob.remcomp.fr> - 2018-02-15 22:57 +0100
      Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 22:58 +0000
        Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 00:19 +0000
          Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 02:26 +0000
            Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 02:57 +0000
              Re: Text Files asetofsymbols@gmail.com - 2018-02-16 00:21 -0800
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 11:30 +0000
          Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 10:36 +0100
            Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 11:36 +0000
              Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 13:10 +0100
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 12:25 +0000
                Re: Text Files Ike Naar <ike@iceland.freeshell.org> - 2018-03-06 19:33 +0000
                Re: Text Files bartc <bc@freeuk.com> - 2018-03-06 20:55 +0000
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-16 04:42 -0800
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 16:58 +0100
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 20:02 +0000
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 21:43 +0100
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-17 04:01 -0800
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-17 13:10 +0000
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-17 05:27 -0800
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-17 14:20 +0000
                Re: Text Files Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-16 09:04 -0700
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 14:31 +0000
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-16 06:42 -0800
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-16 14:58 +0000
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-16 07:23 -0800
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-16 15:24 +0000
              Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-16 04:13 -0800
                Re: Text Files Siri Cruise <chine.bleu@yahoo.com> - 2018-02-16 04:29 -0800
                Re: Text Files Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-20 16:41 +0000
                Re: Text Files Siri Cruise <chine.bleu@yahoo.com> - 2018-02-20 09:39 -0800
                Re: Text Files Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-20 19:16 +0000
  Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 12:46 +0000
    Re: Text Files GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-15 14:52 +0100
    Re: Text Files Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-02-15 17:07 +0300
      Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 14:23 +0000
        Re: Text Files Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-02-15 18:52 +0300
    Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 14:39 +0000
      Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 15:43 +0000
        Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 20:32 +0000
          Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 22:06 +0000
            Re: Text Files GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-15 23:12 +0100
            Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-15 15:12 -0800
              Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 23:43 +0000
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 23:54 +0000
            Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 23:35 +0000
          Re: Text Files Tim Rentsch <txr@alumni.caltech.edu> - 2018-02-16 17:07 -0800
            Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-17 02:38 +0000
              Re: Text Files Ian Collins <ian-news@hotmail.com> - 2018-02-17 17:26 +1300
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-17 11:22 +0000
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-17 12:07 +0000
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-17 04:17 -0800
                Re: Text Files Anton Shepelev <anton.txt@gmail.com> - 2018-02-17 16:25 +0300
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-17 07:35 -0800
                Re: Text Files GOTHIER Nathan <nathan.gothier@gmail.com> - 2018-02-17 15:24 +0100
                Re: Text Files Ian Collins <ian-news@hotmail.com> - 2018-02-18 11:10 +1300
              Re: Text Files Tim Rentsch <txr@alumni.caltech.edu> - 2018-02-19 12:05 -0800
                Re: Text Files already5chosen@yahoo.com - 2018-02-19 15:32 -0800
                Re: Text Files Tim Rentsch <txr@alumni.caltech.edu> - 2018-02-21 10:34 -0800
                Re: Text Files already5chosen@yahoo.com - 2018-02-21 15:35 -0800
                Re: Text Files bartc <bc@freeuk.com> - 2018-02-22 00:11 +0000
                Re: Text Files Robert Wessel <robertwessel2@yahoo.com> - 2018-02-21 18:26 -0600
                Re: Text Files Tim Rentsch <txr@alumni.caltech.edu> - 2018-02-21 21:39 -0800
                Re: Text Files Robert Wessel <robertwessel2@yahoo.com> - 2018-02-23 03:08 -0600
                Re: Text Files supercat@casperkitty.com - 2018-02-23 16:16 -0800
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-23 16:46 -0800
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-24 02:49 -0800
                Re: Text Files asetofsymbols@gmail.com - 2018-02-24 05:16 -0800
                Re: Text Files "F. Russell" <fr@random.info> - 2018-02-24 14:35 +0000
                Re: Text Files Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-24 08:48 -0700
                Re: Text Files supercat@casperkitty.com - 2018-02-25 15:09 -0800
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-25 15:54 -0800
                Re: Text Files supercat@casperkitty.com - 2018-02-26 11:04 -0800
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-26 11:52 -0800
                Re: Text Files supercat@casperkitty.com - 2018-02-26 14:12 -0800
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-26 14:40 -0800
                Re: Text Files already5chosen@yahoo.com - 2018-02-22 04:58 -0800
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-22 05:33 -0800
                Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-22 13:59 +0000
                Re: Text Files Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-22 07:24 -0800
              Re: Text Files supercat@casperkitty.com - 2018-02-20 12:14 -0800
        Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-15 21:37 +0100
          Re: Text Files bartc <bc@freeuk.com> - 2018-02-15 21:34 +0000
            Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-15 14:15 -0800
            Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-16 10:47 +0100
  Re: Text Files "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-02-15 22:20 +0800
  Re: Text Files "F. Russell" <fr@random.info> - 2018-02-15 15:24 +0000
    Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-15 16:05 +0000
    Re: Text Files "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-02-16 00:22 +0800
    Re: Text Files Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-15 13:35 -0700
  Re: Text Files Anton Shepelev <anton.txt@gmail.com> - 2018-02-25 00:13 +0300
    Re: Text Files bartc <bc@freeuk.com> - 2018-02-24 21:24 +0000
      Re: Text Files Anton Shepelev <anton.txt@gmail.com> - 2018-02-25 14:55 +0300
        Re: Text Files bartc <bc@freeuk.com> - 2018-02-25 13:00 +0000
    Re: Text Files Real Troll <Real.Troll@Trolls.com> - 2018-02-24 17:35 -0400
    Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-24 21:36 +0000
      Re: Text Files Real Troll <Real.Troll@Trolls.com> - 2018-02-24 17:45 -0400
      Re: Text Files Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-24 22:51 +0000
        Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-24 23:56 +0000
          Re: Text Files bartc <bc@freeuk.com> - 2018-02-25 00:14 +0000
            Re: Text Files bartc <bc@freeuk.com> - 2018-02-25 00:22 +0000
            Re: Text Files Anton Shepelev <anton.txt@gmail.com> - 2018-02-25 15:16 +0300
              Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-25 15:20 -0800
                Re: Text Files Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-25 20:27 -0700
                Re: Text Files gazelle@shell.xmission.com (Kenny McCormack) - 2018-02-26 06:19 +0000
                Re: Text Files Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-02-26 15:35 +0300
                Re: Text Files Reinhardt Behm <rbehm@hushmail.com> - 2018-02-26 20:53 +0800
                Grammar Patrol (Was: Text Files) gazelle@shell.xmission.com (Kenny McCormack) - 2018-02-26 17:54 +0000
                Re: Text Files Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-26 15:27 +0000
                Re: Text Files Anton Shepelev <anton.txt@g{oogle}mail.com> - 2018-02-26 18:50 +0300
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-26 09:26 -0800
                Re: Text Files scott@slp53.sl.home (Scott Lurndal) - 2018-02-26 19:46 +0000
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-27 09:04 +0100
                Re: Text Files already5chosen@yahoo.com - 2018-02-27 00:56 -0800
                Re: Text Files Ian Collins <ian-news@hotmail.com> - 2018-02-27 22:07 +1300
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-27 14:37 +0100
                Re: Text Files already5chosen@yahoo.com - 2018-02-27 07:38 -0800
                Re: Text Files supercat@casperkitty.com - 2018-02-27 09:18 -0800
                Re: Text Files David Brown <david.brown@hesbynett.no> - 2018-02-27 10:15 +0100
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-27 08:53 -0800
                Re: Text Files Tim Rentsch <txr@alumni.caltech.edu> - 2018-02-26 23:14 -0800
                Re: Text Files Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-26 08:32 -0700
                Re: Text Files Keith Thompson <kst-u@mib.org> - 2018-02-26 09:17 -0800
                Re: Text Files Tim Rentsch <txr@alumni.caltech.edu> - 2018-02-26 22:55 -0800
      Re: Text Files Anton Shepelev <anton.txt@gmail.com> - 2018-02-25 15:02 +0300
        Re: Text Files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-25 20:12 +0000

csiph-web