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


Groups > comp.lang.c > #69871

Re: disadvantages of using old parameter syntax?

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: disadvantages of using old parameter syntax?
Date 2015-09-08 08:51 +0200
Organization A noiseless patient Spider
Message-ID <msm0dp$l5o$1@dont-email.me> (permalink)
References <msc3ru$d6a$1@speranza.aioe.org> <b94ee17e-9f9c-4d9e-b519-227b1cb79cda@googlegroups.com> <mseos9$c7g$1@dont-email.me> <cc839e1c-8df7-4b36-ba3a-5dd4d3676190@googlegroups.com>

Show all headers | View raw


On 07/09/15 22:26, Malcolm McLean wrote:
> On Saturday, September 5, 2015 at 1:59:43 PM UTC+1, David Brown wrote:
>>
>> The problem with the old-style functions in C is that they don't declare
>> a list of parameters and types for a function signature.  The function
>> itself takes an unspecified number of parameters, and the list of types
>> in the old-style function definition say how these parameters should be
>> interpreted.  That's a very different thing - and it is a very /bad/
>> thing, because it forces the programmer to do a good deal more manual
>> work and a good deal more manual checking.
>>
> Bad but not _very_ bad.
> 
> I'm currently hooking up a UI which I'm writing in a javascript variant
> to a core program written in C++. So of course you lose all the type
> safety when passing parameters across the divide - I call the script
> from C by passing string in JSON, and there's a "script-variable"
> object which defines the interface going the other way.
> 
> It's a nuisance but not a disaster. Type errors are caught at runtime
> rather than at compile time. But almost always they will be caught 
> on the first test - all the json has set fields, there's not a single
> example of a dynamic interface (by which I mean when the same 
> user-space function is passed a structure with fields of a different 
> type). So if the first test doesn't fail then it would be extremely
> unlucky.
> 

There are times where you cannot do compile-time type checking.  You've
mentioned one of them, another would be when using languages that have
dynamic typing and duck typing (such as Python).  The relegation of such
checks to run-time rather than compile time is a strong disadvantage -
it is always best to spot errors as soon as possible.  But if the
advantages are big enough, or there is no good way around it, then you
accept that cost - it's a balance design decision that you make.

In this case, however, the OP was wondering about using old-style C
function definitions.  Doing so would be to through away type
information - for type checking, and automatic conversions - for /no/
benefit.  That would be a /very/ bad thing.

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


Thread

disadvantages of using old parameter syntax? Anonymous Shadow <rocket.penguin@riseup.net> - 2015-09-04 20:46 +0800
  Re: disadvantages of using old parameter syntax? Anonymous Shadow <rocket.penguin@riseup.net> - 2015-09-04 20:49 +0800
    Re: disadvantages of using old parameter syntax? raltbos@xs4all.nl (Richard Bos) - 2015-09-04 16:19 +0000
  Re: disadvantages of using old parameter syntax? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-04 10:10 -0400
    Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 17:07 -0700
      Re: disadvantages of using old parameter syntax? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 01:57 +0100
        Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 18:09 -0700
          Re: disadvantages of using old parameter syntax? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 02:47 +0100
            Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 19:34 -0700
              Re: disadvantages of using old parameter syntax? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 12:07 +0100
          Re: disadvantages of using old parameter syntax? David Brown <david.brown@hesbynett.no> - 2015-09-09 13:18 +0200
  Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-04 07:23 -0700
    Re: disadvantages of using old parameter syntax? mark.bluemel@gmail.com - 2015-09-04 07:45 -0700
    Re: disadvantages of using old parameter syntax? David Brown <david.brown@hesbynett.no> - 2015-09-05 14:59 +0200
      Re: disadvantages of using old parameter syntax? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-07 13:26 -0700
        Re: disadvantages of using old parameter syntax? David Brown <david.brown@hesbynett.no> - 2015-09-08 08:51 +0200
      Re: (Not) discussing C-like toy languages Noob <root@127.0.0.1> - 2015-09-08 13:35 +0200
        Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-08 13:59 +0200
          Re: (Not) discussing C-like toy languages gazelle@shell.xmission.com (Kenny McCormack) - 2015-09-08 12:35 +0000
            Re: (Not) discussing C-like toy languages Noob <root@127.0.0.1> - 2015-09-08 17:55 +0200
              Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-08 13:11 -0400
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 10:19 -0700
                Re: (Not) discussing C-like toy languages Noob <root@127.0.0.1> - 2015-09-08 21:31 +0200
                Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-08 20:33 +0100
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-08 22:56 +0200
                Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 19:31 +0000
                Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-20 16:09 -0400
                Re: (Not) discussing C-like toy languages Morris Dovey <mrdovey@iedu.com> - 2015-09-21 18:51 -0500
                Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-20 21:27 +0100
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-08 22:52 +0200
                Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-08 21:59 +0100
                Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 19:31 +0000
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-20 13:54 -0700
            Re: (Not) discussing C-like toy languages Gareth Owen <gwowen@gmail.com> - 2015-09-08 21:28 +0100
        Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-08 10:56 -0400
          Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 08:33 -0700
            Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-08 09:12 -0700
              Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 09:18 -0700
                Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-08 10:15 -0700
          Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 08:38 -0700
          Re: (Not) discussing C-like toy languages luser droog <luser.droog@gmail.com> - 2015-09-08 16:50 -0700
            Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-08 21:24 -0400
              Re: (Not) discussing C-like toy languages luser droog <luser.droog@gmail.com> - 2015-09-11 08:45 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-11 08:54 -0700
                Re: (Not) discussing C-like toy languages luser droog <luser.droog@gmail.com> - 2015-09-11 21:22 -0700
                Re: (Not) discussing C-like toy languages Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-13 06:42 +0000
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-12 23:54 -0700
                Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-13 10:41 -0500
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 09:52 -0700
                Re: (Not) discussing C-like toy languages Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-13 20:27 +0000
                Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-14 21:32 -0500
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 09:55 -0700
                Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 09:07 +1200
                Re: (Not) discussing C-like toy languages "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-09-13 14:23 -0700
                Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 09:31 +1200
                Re: (Not) discussing C-like toy languages "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-09-13 14:33 -0700
                Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 09:40 +1200
                Re: (Not) discussing C-like toy languages "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-09-13 15:05 -0700
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 00:10 +0200
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-13 17:16 -0700
                Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-14 21:36 -0500
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 14:29 -0700
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-13 23:47 +0200
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 17:55 -0700
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 10:20 +0200
                Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-14 11:01 +0100
                Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 22:07 +1200
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 12:41 +0200
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 03:47 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 04:05 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 04:20 -0700
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 05:51 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 06:06 -0700
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 06:26 -0700
                Re: (Not) discussing C-like toy languages gazelle@shell.xmission.com (Kenny McCormack) - 2015-09-14 13:43 +0000
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 07:26 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 06:47 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 03:31 -0700
                Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-14 06:40 -0400
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 14:27 +0200
                Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-14 13:39 +0100
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 05:55 -0700
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 05:50 -0700
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 15:58 +0200
                Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 07:37 -0700
                Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-14 07:43 -0700
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 17:21 +0200
                Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 08:53 -0700
                Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 18:23 +0200
                Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-14 10:57 -0700
                Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-17 17:43 -0700
                Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 20:50 +0000
                Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 20:48 +0000
                Re: (Not) discussing C-like toy languages Keith Thompson <kst-u@mib.org> - 2015-09-14 07:58 -0700
                Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-14 21:35 -0500
            Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 23:56 -0700
        Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-08 08:07 -0700
    Re: disadvantages of using old parameter syntax? luser droog <luser.droog@gmail.com> - 2015-09-08 17:40 -0700
      Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 17:59 -0700
  Re: disadvantages of using old parameter syntax? James Kuyper <jameskuyper@verizon.net> - 2015-09-04 10:48 -0400
  Re: disadvantages of using old parameter syntax? Paul N <gw7rib@aol.com> - 2015-09-07 12:48 -0700
  Re: disadvantages of using old parameter syntax? Anonymous Shadow <rocket.penguin@riseup.net> - 2015-09-12 15:35 +0800
    Re: disadvantages of using old parameter syntax? Keith Thompson <kst-u@mib.org> - 2015-09-12 14:25 -0700
      Re: disadvantages of using old parameter syntax? supercat@casperkitty.com - 2015-09-12 14:53 -0700
        Re: disadvantages of using old parameter syntax? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-12 18:21 -0400
  Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 11:41 -0700
    Re: disadvantages of using old parameter syntax? Rosario19 <Ros@invalid.invalid> - 2015-09-16 09:02 +0200
      Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-16 01:12 -0700

csiph-web