Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jun 2009 10:23:01 +0900
From:      till plewe <till.plewe@gmail.com>
To:        Gary Kline <kline@thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: is there a macro that prints the incoming param list?
Message-ID:  <8be8566f0905311823y7871c5a3q1b8d57a4d9f520c@mail.gmail.com>
In-Reply-To: <20090601010602.GA9692@thought.org>
References:  <20090601010602.GA9692@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 1, 2009 at 10:06 AM, Gary Kline <kline@thought.org> wrote:
>
> is there any marco that printfs the incoming list, or am i asking too much of the
> compiler at runtime?
>
> example:
>
>        main (int argc, char *argv)
>
>        with this macro might print:
>
>        "2", "testinput"
>
>        and baz(char *file, int count)
>
>        similarly might print,
>
>        "testinput", "47"
>
>        i'm probably asking the impossible, but this is certainly the place to
>        ask.
>
>        thanks,
>
>        gary
>
>
>        ps: i'm looking to create a DEBUG header.
>
>
>
> --
>  Gary Kline  kline@thought.org  http://www.thought.org  Public Service Unix
>        http://jottings.thought.org   http://transfinite.thought.org
>    The 4.91a release of Jottings: http://jottings.thought.org/index.php
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>

How is the macro supposed to know how to print the arguments?
There may be user defined types.

The simplest way would be to add a printf statement after each
function definition.

You could write scripts which generate the format strings for you from
your header files and then use a (variadic) macro which expects that you have
generated a table which contains for each function name the corresponding
format string and argument list.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8be8566f0905311823y7871c5a3q1b8d57a4d9f520c>