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


Groups > comp.lang.c > #57934

Re: I need to vent some steam

Date 2015-03-06 17:54 +0100
From Anders Wegge Keller <wegge@geostat.dk>
Newsgroups comp.lang.c
Subject Re: I need to vent some steam
Message-ID <20150306175432.79873d61@geostat.dk> (permalink)
References <20150305170109.221d04fe@geostat.dk> <jrjifah6uj9qlqsu758t9mg54odkq82528@4ax.com> <mdc08d$5mu$1@dont-email.me> <majjfap1nrvc5rb8rh7frcbt8kgicr0hh3@4ax.com>
Organization Disorganized

Show all headers | View raw


On Fri, 06 Mar 2015 08:03:49 -0800
Geoff <geoff@invalid.invalid> wrote:

> On Fri, 06 Mar 2015 10:41:57 +0000, Bartc <bc@freeuk.com> wrote:
> 
> >On 06/03/2015 07:14, Geoff wrote:

> >> Assume we have an airport with a kiosk with flight arrival departure
> >> information and we'd like to keep all the flight numbers as 4 digit
> >> fixed width fields after the two-letter airline code. Let's also
> >> assume the buffer is properly prepared before it's used:

 The code in question is a part of the interface between the luggage sorting
system, and a high level system, that has the information about which
luggage tag goes to which spur line. So the assumption is off, but as a
guess, it's pretty good.
...

> >The bigger question is why use C for such an application, when there are 
> >so many more apt languages to do this stuff.
 
> C was the language chosen at the time the code was written. I'd like
> to know what languages you think might be appropriate. The OP is
> obviously involved in either a re-write or a conversion of the legacy
> code and may enlighten us but anything we say here is pure
> speculation. I was offering one such speculation and admiring the
> offered function for what it was, simple, concise, free-standing.

 The code is written in the late nineties. It's an adaptation of the generic
control system, that was written in the start of that decade. Given the
realtime requirements of the system, and the hardware available at that
time, C was one of the few available options at that time. 

> For reasons unknown to us the original author of the code had a reason
> for avoiding the printf family. I'd love to know why.

 My rationale for posting the code, was to vent the frustration over working
with code that reinvents large parts of the standard library. As i wrote
elsewhere, there is also a 400-line function, that reimplements printf(). 

> 
> >But even in C, what is wrong with:
> >
> >	printf("Galactic Airlines GA%04d\n", 42);
> 
> It's wrong for the simple reason it fails to adhere to the functional
> specification. It prints a _minimum_ of four digits, not _precisely_
> four digits. 

 In this case, a simple sprintf() would have been enough. The range of input
values cannot overflow the widths.

-- 
//Wegge

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


Thread

I need to vent some steam Anders Wegge Keller <wegge@geostat.dk> - 2015-03-05 17:01 +0100
  Re: I need to vent some steam Morris Dovey <mrdovey@iedu.com> - 2015-03-05 10:32 -0600
  Re: I need to vent some steam Richard Heathfield <rjh@cpax.org.uk> - 2015-03-05 17:04 +0000
    Re: I need to vent some steam Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-03-05 17:42 +0000
    Re: I need to vent some steam glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-03-05 19:16 +0000
      Re: I need to vent some steam jacob navia <jacob@spamsink.net> - 2015-03-05 20:47 +0100
    Re: I need to vent some steam Anders Wegge Keller <wegge@geostat.dk> - 2015-03-05 20:52 +0100
    Re: I need to vent some steam Kaz Kylheku <kaz@kylheku.com> - 2015-03-05 22:20 +0000
  Re: I need to vent some steam Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-03-05 17:51 +0000
  Re: I need to vent some steam Kaz Kylheku <kaz@kylheku.com> - 2015-03-05 22:20 +0000
  Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-05 23:14 -0800
    Re: I need to vent some steam Bartc <bc@freeuk.com> - 2015-03-06 10:41 +0000
      Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-06 08:03 -0800
        Re: I need to vent some steam Bartc <bc@freeuk.com> - 2015-03-06 16:50 +0000
          Re: I need to vent some steam Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-06 15:32 -0800
          Re: I need to vent some steam Öö Tiib <ootiib@hot.ee> - 2015-03-07 07:59 -0800
            Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-07 16:22 -0800
              Re: I need to vent some steam James Kuyper <jameskuyper@verizon.net> - 2015-03-07 19:45 -0500
                Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-07 17:21 -0800
                Re: I need to vent some steam Bartc <bc@freeuk.com> - 2015-03-08 10:29 +0000
                Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-08 13:37 -0700
          Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-07 16:20 -0800
        Re: I need to vent some steam Anders Wegge Keller <wegge@geostat.dk> - 2015-03-06 17:54 +0100
          Re: I need to vent some steam Geoff <geoff@invalid.invalid> - 2015-03-06 09:58 -0800
    Re: I need to vent some steam Morris Dovey <mrdovey@iedu.com> - 2015-03-07 02:29 -0600
      Re: I need to vent some steam Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-03-07 11:01 +0000
      Re: I need to vent some steam Tim Rentsch <txr@alumni.caltech.edu> - 2015-03-24 10:46 -0700
  Re: I need to vent some steam Richard Damon <Richard@Damon-Family.org> - 2015-03-06 08:34 -0500
    Re: I need to vent some steam Les Cargill <lcargill99@comcast.com> - 2015-03-06 08:17 -0600
      Re: I need to vent some steam Keith Thompson <kst-u@mib.org> - 2015-03-06 08:02 -0800
      Re: I need to vent some steam Richard Damon <Richard@Damon-Family.org> - 2015-03-06 22:38 -0500
    Re: I need to vent some steam Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-03-06 15:44 -0800
      Re: I need to vent some steam Ian Collins <ian-news@hotmail.com> - 2015-03-07 13:35 +1300
  Re: I need to vent some steam Ian Collins <ian-news@hotmail.com> - 2015-03-07 07:42 +1300
  Re: I need to vent some steam raltbos@xs4all.nl (Richard Bos) - 2015-03-06 22:51 +0000
  Re: I need to vent some steam Michael Angelo Ravera <maravera@prodigy.net> - 2015-03-06 16:48 -0800
  Re: I need to vent some steam Xcott Craver <xcottcraver@gmail.com> - 2015-03-09 08:52 -0700
    Re: I need to vent some steam Anders Wegge Keller <wegge@geostat.dk> - 2015-03-09 21:11 +0100
      Re: I need to vent some steam Kaz Kylheku <kaz@kylheku.com> - 2015-03-09 20:16 +0000
        Re: I need to vent some steam Anders Wegge Keller <wegge@geostat.dk> - 2015-03-09 21:38 +0100
          Re: I need to vent some steam Kaz Kylheku <kaz@kylheku.com> - 2015-03-09 20:54 +0000
            Re: I need to vent some steam David Brown <david.brown@hesbynett.no> - 2015-03-10 09:02 +0100
              Re: I need to vent some steam Robert Wessel <robertwessel2@yahoo.com> - 2015-03-10 05:34 -0500
        Re: I need to vent some steam Robert Wessel <robertwessel2@yahoo.com> - 2015-03-09 19:15 -0500
      Re: I need to vent some steam Keith Thompson <kst-u@mib.org> - 2015-03-10 07:55 -0700

csiph-web