Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.c > #387530

Re: is it possible to have functions with 0, 1, or 2 args?

Path csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: is it possible to have functions with 0, 1, or 2 args?
Date Mon, 12 Aug 2024 15:39:10 -0700
Organization A noiseless patient Spider
Lines 39
Message-ID <86v8051i41.fsf@linuxsc.com> (permalink)
References <7q-dnbTDU4oBES37nZ2dnZfqnPednZ2d@brightview.co.uk> <20240805151946.00000bce@yahoo.com> <86wmkmfhaz.fsf@linuxsc.com> <v9chcl$37e8f$1@dont-email.me> <8634naccp3.fsf@linuxsc.com> <v9colj$38jkq$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Date Tue, 13 Aug 2024 00:39:10 +0200 (CEST)
Injection-Info dont-email.me; posting-host="7741d78d7fa92162b25738c81b1a0845"; logging-data="3686921"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+cMdjMHTn/oGqgakH1F8W2bb4DBY7BbI="
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock sha1:4j1KlZMz4gSas2UWqzdxgb+NM9Q= sha1:2aTB7HReocudSCBAt55vi35dGSc=
Xref csiph.com comp.lang.c:387530

Show key headers only | View raw


Richard Harnden <richard.nospam@gmail.invalid> writes:

> On 12/08/2024 10:28, Tim Rentsch wrote:
>
>> Richard Harnden <richard.nospam@gmail.invalid> writes:
>>
>>> On 12/08/2024 06:20, Tim Rentsch wrote:
>>>
>>>> Michael S <already5chosen@yahoo.com> writes:
>>>>
>>>>> On Mon, 05 Aug 2024 08:26:04 +0000
>>>>> Mark Summerfield <mark@qtrac.eu> wrote:
>>>>>
>>>>> According to my understanding, vararg functions without arguments will
>>>>> become possible in C23.  But since fully functional C23 compilers do not
>>>>> exist yet, right now the answer to your question is "No".
>>>>
>>>> Even in C99 varargs functions can be called without arguments.
>>>> The question here is more subtle.  In fact it is possible even
>>>> in C99 and C11 to do what he wants, but it isn't easy, and it
>>>> is far from obvious how to go about it.  Still, if the question
>>>> is "can this be done?", the answer is Yes even now.
>>>
>>> How does va_start know where to, um, start from if there's no last
>>> named argument?
>>
>> Sorry, I meant to say macros, not functions (using ... and __VA_ARGS__).
>> The original question is about macro definitions, not function
>> definitions, and I didn't read carefully enough.
>
> No worries.
>
> So ... how can you do it with macros?

I'm still working on preparing an answer to that question.

> And, even if it's possible, is it a good idea?

An excellent question.  I expect there are two schools of thought. :)

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


Thread

is it possible to have functions with 0, 1, or 2 args? Mark Summerfield <mark@qtrac.eu> - 2024-08-05 08:26 +0000
  Re: is it possible to have functions with 0, 1, or 2 args? Michael S <already5chosen@yahoo.com> - 2024-08-05 15:19 +0300
    Re: is it possible to have functions with 0, 1, or 2 args? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-11 22:20 -0700
      Re: is it possible to have functions with 0, 1, or 2 args? Richard Harnden <richard.nospam@gmail.invalid> - 2024-08-12 09:33 +0100
        Re: is it possible to have functions with 0, 1, or 2 args? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-12 02:28 -0700
          Re: is it possible to have functions with 0, 1, or 2 args? Richard Harnden <richard.nospam@gmail.invalid> - 2024-08-12 11:37 +0100
            Re: is it possible to have functions with 0, 1, or 2 args? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-12 15:39 -0700
  Re: is it possible to have functions with 0, 1, or 2 args? Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2024-08-05 18:46 +0000
  Re: is it possible to have functions with 0, 1, or 2 args? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-08-07 23:04 +0000
  Re: is it possible to have functions with 0, 1, or 2 args? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-11 10:43 -0700
  Re: is it possible to have functions with 0, 1, or 2 args? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-11 22:15 -0700

csiph-web