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

Liste des GroupesRevenir à l c 
Sujet : Re: is it possible to have functions with 0, 1, or 2 args?
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.c
Date : 05. Aug 2024, 11:32:25
Autres entêtes
Organisation : Stefan Ram
Message-ID : <macros-20240805103134@ram.dialup.fu-berlin.de>
References : 1
Mark Summerfield <mark@qtrac.eu> wrote or quoted:
This does *not* work for the `va_test()` call. But if I supply 1 or 2 args
it works great.

  Here's an

SSCCE, a short self-contained correct compilable example, aka,
MWE - minimal working example.

  Some coders whip up these examples themselves for their post!

  It's a quick and dirty demo that can be compiled and run to
  show what's buggin' them.

  In this case, it's hella clear the macros are trippin', thinkin'
  the number of args is "1" when it's actually zilch, nada, zero.

  main.c

#include <stdio.h>

#define NARGS(...) NARGS_(__VA_ARGS__, 5, 4, 3, 2, 1, 0)
#define NARGS_(_5, _4, _3, _2, _1, N, ...) N
#define va_test(...) NARGS(__VA_ARGS__)

int main( void ){ printf( "%d\n", va_test() ); }

  transcript

1

Date Sujet#  Auteur
5 Aug 24 * is it possible to have functions with 0, 1, or 2 args?15Mark Summerfield
5 Aug 24 +- Re: is it possible to have functions with 0, 1, or 2 args?1Stefan Ram
5 Aug 24 +* Re: is it possible to have functions with 0, 1, or 2 args?4Stefan Ram
5 Aug 24 i+* Re: is it possible to have functions with 0, 1, or 2 args?2Stefan Ram
8 Aug 24 ii`- Re: is it possible to have functions with 0, 1, or 2 args?1Lawrence D'Oliveiro
11 Aug 24 i`- Re: is it possible to have functions with 0, 1, or 2 args?1Tim Rentsch
5 Aug 24 +* Re: is it possible to have functions with 0, 1, or 2 args?6Michael S
12 Aug 24 i`* Re: is it possible to have functions with 0, 1, or 2 args?5Tim Rentsch
12 Aug 24 i `* Re: is it possible to have functions with 0, 1, or 2 args?4Richard Harnden
12 Aug 24 i  `* Re: is it possible to have functions with 0, 1, or 2 args?3Tim Rentsch
12 Aug 24 i   `* Re: is it possible to have functions with 0, 1, or 2 args?2Richard Harnden
13 Aug 24 i    `- Re: is it possible to have functions with 0, 1, or 2 args?1Tim Rentsch
5 Aug 24 +- Re: is it possible to have functions with 0, 1, or 2 args?1Stefan Ram
5 Aug 24 +- Re: is it possible to have functions with 0, 1, or 2 args?1Blue-Maned_Hawk
12 Aug 24 `- Re: is it possible to have functions with 0, 1, or 2 args?1Tim Rentsch

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal