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


Groups > comp.lang.c > #13808

Re: Customizing printf

From jgk@panix.com (Joe keane)
Newsgroups comp.lang.c
Subject Re: Customizing printf
Date 2011-11-23 00:09 +0000
Organization Public Access Networks Corp.
Message-ID <jahdjp$ltn$1@reader1.panix.com> (permalink)
References <j9tps6$nc9$1@speranza.aioe.org> <87ipmehbxl.fsf@blp.benpfaff.org> <jaej0f$bg5$1@reader1.panix.com> <20111121145051.881@kylheku.com>

Show all headers | View raw


In article <20111121145051.881@kylheku.com>,
Kaz Kylheku  <kaz@kylheku.com> wrote:
>Suppose you had a translations file with records

For simple things:

    printf("s %3d %9.6f\n", j, sum);

printf works great, and i have no problem with it.

Concise, easy to learn, easy to understand.

If you add user-defined operators (what next, while loops?), and your
format strings are other than compile-time constants, i just think
you'll be dishappy with the result.

I18N is more than switching format strings.  There are libraries to do
it, and you'll probably save yourself headaches if you make use of them.

Anyway it would take no time to write something that takes

    "die $1 unter die $2 gebroken ist"

and is type-safe.  This handles the "$1 de $2" versus "$2 no $1"
problem.  But really it's too simplistic.

Besides what you've done is make a mini scripting language, i think not
a good one.  Again there are libraries to do that; why invent a new one?

I write a lot of things in Perl, and shell; if someone says 'why don't
you write that in C?', i'd say 'why the hell would i do *that*?'.
You're trying to use a hammer where you want a bandsaw...

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


Thread

Customizing printf jacob navia <jacob@spamsink.net> - 2011-11-15 14:36 +0100
  Re: Customizing printf "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-11-15 13:07 -0500
  Re: Customizing printf Ben Pfaff <blp@cs.stanford.edu> - 2011-11-15 10:10 -0800
    Re: Customizing printf jacob navia <jacob@spamsink.net> - 2011-11-15 21:36 +0100
      Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-15 12:51 -0800
        Re: Customizing printf "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-11-15 18:03 -0500
    Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-20 15:14 +0000
      Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-20 10:43 -0800
        Re: Customizing printf Lauri Alanko <la@iki.fi> - 2011-11-20 19:01 +0000
          Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-20 11:05 -0800
            Re: Customizing printf Dag-Erling Smørgrav <des@des.no> - 2011-11-20 20:38 +0100
              Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-20 11:37 -0800
        Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-21 22:23 +0000
          Re: Customizing printf Ian Collins <ian-news@hotmail.com> - 2011-11-22 11:26 +1300
          Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-21 14:23 -0800
          Re: Customizing printf Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 23:06 +0000
            Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-23 00:09 +0000
              Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-22 16:16 -0800
      Re: Customizing printf Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-21 05:29 -0800
        Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-21 22:50 +0000
  Re: Customizing printf Lowell Gilbert <lgusenet@be-well.ilk.org> - 2011-11-15 13:13 -0500
  Re: Customizing printf "-.-" <none@none.none> - 2011-11-16 14:06 +0100
    Re: Customizing printf gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-16 13:40 +0000
    Re: Customizing printf Seebs <usenet-nospam@seebs.net> - 2011-11-16 20:18 +0000
      Re: Customizing printf Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-17 07:54 +0200

csiph-web