• one calling convention (so callled "the one")

    From fir@[email protected] to comp.lang.c on Fri Oct 23 08:08:20 2026
    From Newsgroup: comp.lang.c

    from longer time i think if in c should be not one calling convention
    (or mainly the one)

    the one is

    ( output* out) foo(input* in)
    {

    }

    i mean all argument should be passed by one pointer,
    not passed by stack it should be passed by register,
    same as to output - all values should be returned by
    outupu pointer also by register


    im not totally sure it it could be named the one calling
    convantion but maybe


    (here the one means maybe sometimes main callin convention,
    but sometimes maybe the one calling convention

    the question is sometimes for efficiency reasons you would like maybe to
    pass N input pointers (by registers) or N output pointers via registers

    like if you pass two strings

    foo("asdasD", "qweqwe");

    its more handy to have it in say eax ebx than having in eax the
    pointer to

    arg {char*, char*}


    but in many cased when you use

    foo("asS", x, y)

    pointer to {"asS", x, y} is okay


    so maybe name by one convention th eone which mean


    (one but sometimes many output*) foo (one but sometimes many input*)

    ?




    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@[email protected] to comp.lang.c on Fri Oct 23 11:16:49 2026
    From Newsgroup: comp.lang.c

    On 23/10/2026 08:08, fir wrote:
    from longer time i think if in c should be not one calling convention
    (or mainly the one)

    the one is

    ( output* out) foo(input* in)
    {

    }

    i mean all argument should be passed by one pointer,
    not passed by stack it should be passed by register,
    same as to output - all values should be returned by
    outupu pointer also by register


    For most calling conventions, "in" would be passed in a register and
    "out" returned in a register. The details are from the platform ABI,
    and are not relevant to the C language.

    And if you want your inputs and outputs to be structs, you can already
    do that in C. If these structs are under a certain size (determined by
    the ABI), they are typically passed and returned directly in registers -
    if they are bigger, they are passed using pointers to structs. (The
    caller makes the struct for the parameter, and space for the return struct.)

    You might like to try using godbolt.org and looking at the generated
    assembly to see what code is actually generated.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@[email protected] to comp.lang.c on Fri Oct 23 14:52:28 2026
    From Newsgroup: comp.lang.c

    David Brown pisze:
    On 23/10/2026 08:08, fir wrote:
    from longer time i think if in c should be not one calling convention
    (or mainly the one)

    the one is

    ( output* out) foo(input* in)
    {

    }

    i mean all argument should be passed by one pointer,
    not passed by stack it should be passed by register,
    same as to output - all values should be returned by
    outupu pointer also by register


    For most calling conventions, "in" would be passed in a register and
    "out" returned in a register.  The details are from the platform ABI,
    and are not relevant to the C language.

    And if you want your inputs and outputs to be structs, you can already
    do that in C.  If these structs are under a certain size (determined by
    the ABI), they are typically passed and returned directly in registers -
    if they are bigger, they are passed using pointers to structs.  (The
    caller makes the struct for the parameter, and space for the return
    struct.)

    You might like to try using godbolt.org and looking at the generated assembly to see what code is actually generated.


    i was mostly aware the cdecl and this second one (pascal?) used on win32
    - but it is weirdly vague in my brain now


    conventions are various but what i say here is which ones ar eproper and
    which are less

    (less proper)


    two bointers in registers seem to be the base one, but sometimes
    indeed it may be few pointers in registers or maybe even by value in registers, but the basic one is imo 2 pointers (in/out)

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@[email protected] to comp.lang.c on Fri Oct 23 14:14:08 2026
    From Newsgroup: comp.lang.c

    On 10/22/2026 11:08 PM, fir wrote:
    from longer time i think if in c should be not one calling convention
    (or mainly the one)[...]

    You don't like __cdecl? ;^)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From chine.bleu@[email protected] to comp.lang.c on Sat Oct 24 03:42:41 2026
    From Newsgroup: comp.lang.c

    fir wrote:
    from longer time i think if in c should be not one calling convention
    (or mainly the one)

    the one is

    ( output* out) foo(input* in)
    {

    }

    This disablea function style calls as in Lisp and convert your language
    into verbose assembly code (like Ada).
    --
    Siri Seal of Disavowal #777-000. Disavowed. Denied. @
    NO KINGS For I desire mercy not sacrifice. /|\
    The Church of the Holey Apple .signature 5.5 / \
    of Discordian Mysteries. This post insults Islam. Mohamed
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@[email protected] to comp.lang.c on Sat Oct 24 15:02:55 2026
    From Newsgroup: comp.lang.c

    chine.bleu pisze:
    fir wrote:
    from longer time i think if in c should be not one calling convention
    (or mainly the one)

    the one is

    ( output* out) foo(input* in)
    {

    }

    This disablea function style calls as in Lisp and convert your language
    into verbose assembly code (like Ada).

    c is like verbose asembly imo (depending what verbose means as i not
    sure as to this world)

    c is not like lisp imo for sure..some could rethink if it can but this
    is other story
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@[email protected] to comp.lang.c on Sat Oct 24 15:05:07 2026
    From Newsgroup: comp.lang.c

    Chris M. Thomasson pisze:
    On 10/22/2026 11:08 PM, fir wrote:
    from longer time i think if in c should be not one calling convention
    (or mainly the one)[...]

    You don't like __cdecl? ;^)


    more wide i dislike passing arguments via stack (at least by main stack
    and "by default")



    imo it could be eventually as clearly stated

    foo(stack7 int n) //uses stack7 to pass n
    {

    }

    --- Synchronet 3.22a-Linux NewsLink 1.2