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


Groups > comp.lang.misc > #2053

Re: Wirth-ian languages

From "James Harris" <james.harris.1@gmail.com>
Newsgroups comp.lang.misc
Subject Re: Wirth-ian languages
Date 2014-04-29 07:59 +0100
Organization A noiseless patient Spider
Message-ID <ljnilc$f30$1@dont-email.me> (permalink)
References (2 earlier) <20140428111524.742@kylheku.com> <94y7v.153301$AI5.43400@fx32.am4> <20140428125523.803@kylheku.com> <ljmifb$1gn$1@dont-email.me> <57B7v.161805$Qm2.151455@fx16.am4>

Show all headers | View raw


"BartC" <bc@freeuk.com> wrote in message 
news:57B7v.161805$Qm2.151455@fx16.am4...

...

> Try this one (an actual requirement I had): you have a pointer to a 
> function
> (in a dynamic library for example), and it needs N parameters (to keep
> things simple, they're all of int type). How to call such a function in C
> without writing N different calls? (Let's say N could be 0 to 12; so 13 
> lots
> of calls.)

Perhaps I don't understand the requirement properly but wondered if you 
could use the va_arg facilities. They may be unsafe but they are flexible. 
If fp was the function pointer (and assuming that function pointers are 
automartically derefrenced so the preceding * is not needed) could you do

  fp(1, parm1);
  fp(5, parm1, parm2, parm3, parm4, parm5);

etc?

> (In my languages, I would either step into inline assembly for this, or 
> use
> an odd statement I had called 'stack' which would push any expression onto
> the hardware stack.)

Parms can also be stored as a block in memory. AIUI some would call this a 
control block. The address of the control block can be passed to a function 
such as

  fp(&cb);

Would either that or the va_arg idea above solve the problem you mentioned?

>> Rather than design a new language I wonder how feasible it would be for
>> one of us to evolve C into something better by means of a series of small
>> steps. The language base is there just asking to be improved. Anyone 
>> tried
>> that?
>
> I don't think it's possible without keeping all the bad stuff. It would be
> easier to create a new language, and a few have come out (sadly inheriting
> C's syntax in most cases). Not quite low level enough though.
>
> For example, how do you get rid of the ghastly type declaration syntax in
> one step?

Could you not declare variables and constants in your own preferred way? You 
mean it's hard to come up with a declaration syntax that both looks better 
or is better organised but which is also as comprehensive as C's?

James

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


Thread

Wirth-ian languages bruce axtens <bugmagnet@outlook.com> - 2014-04-28 16:23 +0000
  Re: Wirth-ian languages Joe Hynes <theda@southpark.net> - 2014-04-28 17:31 +0000
    Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-04-28 18:47 +0000
      Re: Wirth-ian languages "BartC" <bc@freeuk.com> - 2014-04-28 20:35 +0100
        Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-04-28 20:18 +0000
          Re: Wirth-ian languages "James Harris" <james.harris.1@gmail.com> - 2014-04-28 22:50 +0100
            Re: Wirth-ian languages "BartC" <bc@freeuk.com> - 2014-04-29 00:03 +0100
              Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-04-28 23:51 +0000
              Re: Wirth-ian languages "James Harris" <james.harris.1@gmail.com> - 2014-04-29 07:59 +0100
                Re: Wirth-ian languages "BartC" <bc@freeuk.com> - 2014-04-29 10:04 +0100
                Re: Wirth-ian languages "James Harris" <james.harris.1@gmail.com> - 2014-04-29 11:33 +0100
                Re: Wirth-ian languages "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-29 07:41 -0400
            Re: Wirth-ian languages "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-28 21:46 -0400
              Re: Wirth-ian languages "James Harris" <james.harris.1@gmail.com> - 2014-04-29 08:24 +0100
                Re: Wirth-ian languages "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-29 07:33 -0400
                Re: Wirth-ian languages "James Harris" <james.harris.1@gmail.com> - 2014-04-29 14:38 +0100
                Re: Wirth-ian languages "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-30 21:28 -0400
                Re: Wirth-ian languages "James Harris" <james.harris.1@gmail.com> - 2014-05-01 10:44 +0100
              Re: Wirth-ian languages "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2014-04-29 09:59 +0200
                Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-04-29 15:51 +0000
                Re: Wirth-ian languages "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2014-04-30 10:57 +0200
                Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-04-30 15:47 +0000
                Re: Wirth-ian languages "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2014-05-01 10:18 +0200
                Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-05-01 16:56 +0000
                Re: Wirth-ian languages "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2014-05-02 10:10 +0200
                Re: Wirth-ian languages "BartC" <bc@freeuk.com> - 2014-04-30 18:27 +0100
                Re: Wirth-ian languages "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2014-05-01 10:18 +0200
                Re: Wirth-ian languages Kaz Kylheku <kaz@kylheku.com> - 2014-05-01 17:10 +0000
                Re: Wirth-ian languages "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2014-05-02 09:22 +0200
  Re: Wirth-ian languages "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-28 20:59 -0400
    Re: Wirth-ian languages "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-28 21:10 -0400
    Re: Wirth-ian languages Nils M Holm <news2009@t3x.org> - 2014-04-29 07:52 +0000
    Re: Wirth-ian languages "BartC" <bc@freeuk.com> - 2014-04-29 09:45 +0100
  Re: Wirth-ian languages Jacko <jackokring@gmail.com> - 2014-04-29 05:37 -0700

csiph-web