Re: Named arguments in C

Liste des GroupesRevenir à cl c  
Sujet : Re: Named arguments in C
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.c
Date : 03. Jul 2024, 01:17:49
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v625bd$1rh22$2@dont-email.me>
References : 1 2 3 4 5
User-Agent : Pan/0.158 (Avdiivka; )
On Tue, 2 Jul 2024 21:53:48 +0500, Ivan Farlenkov wrote:

You can sort of already do it in C by using designated initializers and
macros

There is simply no good way of doing it without having it as a
built-in language feature.

When I was first learning about C (back in the 1980s), it was apparent
that it was a poor fit for my favourite OS of the time, DEC’s VMS.
Consider the ominibus non-file-structured I/O function call, SYS$QIO
<https://support.hpe.com/hpesc/public/docDisplay?docId=emr_na-c04623201>
(page 282 onwards). The C prototype looks like this:

    int sys$qio
      (
        unsigned int efn,
        unsigned short int chan,
        unsigned int func,
        struct _iosb *iosb,
        void (*astadr)(__unknown_params),
        __int64 astprm,
        void *p1,
        __int64 p2,
        __int64 p3,
        __int64 p4,
        __int64 p5,
        __int64 p6
      );

“func” is, or used to be, 10 bits of function code (e.g. read, write)
plus 6 bits of function modifier (e.g. do read with timeout). The
generic arguments p1-p6 have function-dependent meanings, though p1 is
usually a buffer address.

This call is asynchronous, and offers 3 different ways of notifying
I/O completion: by setting an “event flag” (the number of which is
specified in the “efn” arg), by filling in an “I/O status block” (the
address of which can be passed in the “iosb” arg), and by invoking an
“AST” (“Asynchronous System Trap”) completion routine, the address of
which can be passed in the “astadr” arg (plus an extra arg for caller
use in “astprm” that could be used, for example, to identify the
context of the I/O request in question).

The only function I can remember that used all 6 function-specific
arguments was the “read-with-prompt” function of the terminal driver,
with the timeout option. In this call, we had
    p1 -- the buffer in which to return the user input
    p2 -- the length of the input buffer
    p3 -- the read timeout in seconds
    p4 -- the read termination character mask
    p5 -- the address of the prompt string to display
    p6 -- the length of the prompt string

What was good about read-with-prompt, versus doing your own output of
the prompt string followed by a simple read? It could automatically
redisplay your prompt string in any situation where the screen got
messed up and needed refreshing (e.g. after a system broadcast message
was displayed).

Date Sujet#  Auteur
21 Mar 24 * Block Comments Or Rest-Of-Line Comments?72Lawrence D'Oliveiro
21 Mar 24 +- Re: Block Comments Or Rest-Of-Line Comments?1bart
21 Mar 24 +* Re: Block Comments Or Rest-Of-Line Comments?31Mikko
21 Mar 24 i`* Re: Block Comments Or Rest-Of-Line Comments?30Lawrence D'Oliveiro
22 Mar 24 i `* Re: Block Comments Or Rest-Of-Line Comments?29David Brown
22 Mar 24 i  +- Re: Block Comments Or Rest-Of-Line Comments?1Blue-Maned_Hawk
23 Mar 24 i  +* Re: Block Comments Or Rest-Of-Line Comments?5Lawrence D'Oliveiro
23 Mar 24 i  i+* Re: Block Comments Or Rest-Of-Line Comments?2Chris M. Thomasson
23 Mar 24 i  ii`- Re: Block Comments Or Rest-Of-Line Comments?1Lawrence D'Oliveiro
23 Mar 24 i  i`* Re: Block Comments Or Rest-Of-Line Comments?2David Brown
23 Mar 24 i  i `- Re: Block Comments Or Rest-Of-Line Comments?1Malcolm McLean
2 Jul 24 i  `* Named arguments in C22Ivan Farlenkov
2 Jul 24 i   +* Re: Named arguments in C12Blue-Maned_Hawk
2 Jul 24 i   i+* Re: Named arguments in C4Richard Harnden
3 Jul 24 i   ii`* Re: Named arguments in C3Blue-Maned_Hawk
4 Jul 24 i   ii `* Re: Named arguments in C2Richard Harnden
4 Jul 24 i   ii  `- Re: Named arguments in C1Kaz Kylheku
2 Jul 24 i   i`* Re: Named arguments in C7bart
3 Jul 24 i   i +- Re: Named arguments in C1Keith Thompson
3 Jul 24 i   i +* Re: Named arguments in C4Blue-Maned_Hawk
4 Jul 24 i   i i`* Re: Named arguments in C3bart
4 Jul 24 i   i i `* Re: Named arguments in C2Keith Thompson
4 Jul 24 i   i i  `- Re: Named arguments in C1Kaz Kylheku
4 Jul 24 i   i `- Re: Named arguments in C1Opus
3 Jul 24 i   +- Re: Named arguments in C1Lawrence D'Oliveiro
4 Jul 24 i   `* Re: Named arguments in C8Bonita Montero
4 Jul 24 i    +* Re: Named arguments in C2Michael S
4 Jul 24 i    i`- Re: Named arguments in C1Michael S
4 Jul 24 i    `* Re: Named arguments in C5bart
4 Jul 24 i     `* Re: Named arguments in C4Bonita Montero
4 Jul 24 i      +- Re: Named arguments in C1Bonita Montero
4 Jul 24 i      `* Re: Named arguments in C2bart
4 Jul 24 i       `- Re: Named arguments in C1Bonita Montero
21 Mar 24 +- Re: Block Comments Or Rest-Of-Line Comments?1Blue-Maned_Hawk
21 Mar 24 +* Re: Block Comments Or Rest-Of-Line Comments?4Tim Rentsch
21 Mar 24 i`* Re: Block Comments Or Rest-Of-Line Comments?3Dan Cross
22 Mar 24 i `* Re: Block Comments Or Rest-Of-Line Comments?2Tim Rentsch
23 Mar 24 i  `- Re: Block Comments Or Rest-Of-Line Comments?1Dan Cross
21 Mar 24 +* Re: Block Comments Or Rest-Of-Line Comments?16David Brown
21 Mar 24 i`* Re: Block Comments Or Rest-Of-Line Comments?15Richard Harnden
21 Mar 24 i +* Re: Block Comments Or Rest-Of-Line Comments?13Keith Thompson
21 Mar 24 i i+* Re: Block Comments Or Rest-Of-Line Comments?5Richard Harnden
21 Mar 24 i ii`* Re: Block Comments Or Rest-Of-Line Comments?4Keith Thompson
21 Mar 24 i ii +- Re: Block Comments Or Rest-Of-Line Comments?1Richard Harnden
21 Mar 24 i ii `* Re: Block Comments Or Rest-Of-Line Comments?2Lawrence D'Oliveiro
22 Mar 24 i ii  `- Re: Block Comments Or Rest-Of-Line Comments?1Keith Thompson
21 Mar 24 i i+* Re: Block Comments Or Rest-Of-Line Comments?2Kaz Kylheku
22 Mar 24 i ii`- Re: Block Comments Or Rest-Of-Line Comments?1Keith Thompson
21 Mar 24 i i+* Re: Block Comments Or Rest-Of-Line Comments?2Kaz Kylheku
27 Apr 24 i ii`- Re: Block Comments Or Rest-Of-Line Comments?1paul
22 Mar 24 i i`* Re: Block Comments Or Rest-Of-Line Comments?3James Kuyper
22 Mar 24 i i +- Re: Block Comments Or Rest-Of-Line Comments?1Keith Thompson
23 Mar 24 i i `- Re: Block Comments Or Rest-Of-Line Comments?1Lawrence D'Oliveiro
22 Mar 24 i `- Re: Block Comments Or Rest-Of-Line Comments?1David Brown
21 Mar 24 +* Re: Block Comments Or Rest-Of-Line Comments?2fir
21 Mar 24 i`- Re: Block Comments Or Rest-Of-Line Comments?1Lawrence D'Oliveiro
23 Mar 24 +- Re: Block Comments Or Rest-Of-Line Comments?1Malcolm McLean
23 Apr 24 +* Re: Block Comments Or Rest-Of-Line Comments?9DFS
24 Apr 24 i+- Re: Block Comments Or Rest-Of-Line Comments?1Lawrence D'Oliveiro
24 Apr 24 i`* Re: Block Comments Or Rest-Of-Line Comments?7Blue-Maned_Hawk
24 Apr 24 i +* Re: Block Comments Or Rest-Of-Line Comments?2Sjouke Burry
25 Apr 24 i i`- Re: Block Comments Or Rest-Of-Line Comments?1Blue-Maned_Hawk
25 Apr 24 i `* Re: Block Comments Or Rest-Of-Line Comments?4DFS
26 Apr 24 i  `* Re: Block Comments Or Rest-Of-Line Comments?3Blue-Maned_Hawk
26 Apr 24 i   +- Re: Block Comments Or Rest-Of-Line Comments?1Chris M. Thomasson
26 Apr 24 i   `- Re: Block Comments Or Rest-Of-Line Comments?1DFS
23 Apr 24 +* Re: Block Comments Or Rest-Of-Line Comments?5Kaz Kylheku
24 Apr 24 i`* Re: Block Comments Or Rest-Of-Line Comments?4Lowell Gilbert
24 Apr 24 i +* Re: Block Comments Or Rest-Of-Line Comments?2Ben Bacarisse
24 Apr 24 i i`- Re: Block Comments Or Rest-Of-Line Comments?1Lowell Gilbert
24 Apr 24 i `- Re: Block Comments Or Rest-Of-Line Comments?1Kaz Kylheku
27 Apr 24 `- Re: Block Comments Or Rest-Of-Line Comments?1paul

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal