From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: cluts weekly reports
Date: Wed, 3 Aug 2011 14:19:08 -0400 [thread overview]
Message-ID: <20110803181908.GZ132@brightrain.aerifal.cx> (raw)
In-Reply-To: <4E398D5A.6080207@gmail.com>
On Wed, Aug 03, 2011 at 08:03:06PM +0200, Luka Marčetić wrote:
> Ideally what I'd want is:
>
> fp(args)
>
> where fp is a function pointer to functions with different
> prototypes, and args are a number of arguments, each of an arbitrary
> type. Or at least:
>
> if (nr_args == 1)
> fp (*(type[0] *) arg[0]);
> else if (nr_args == 2)
> fp (*(type[0] *) arg[0], *(type[1] *) arg[1]);
>
> What I'm doing instead essentially is:
>
> if (fp == specific_function)
> specific_function(*(int*)arg[0], *(char **)arg[1]);
> else if (fp == another_function)
> another_function(*(size_t *)arg[0]);
There's definitely a better way to do this. If nothing else, you could
write one-line wrappers for each function you want to test and put a
pointer to the wrapper rather than the function itself in the table.
> That just dislocates above, and puts it into the function to be
> called with the arg pointer (and, don't forget, the function
> identifier). I can go to IRC if you want to see what the generator
> output is/should be, and based on what input.
Could you include some here?
Rich
next prev parent reply other threads:[~2011-08-03 18:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 17:10 Luka M.
2011-07-25 23:04 ` Luka M.
2011-08-03 0:56 ` Solar Designer
2011-08-03 1:21 ` Rich Felker
2011-08-03 13:15 ` Luka Marčetić
2011-08-03 13:31 ` Rich Felker
2011-08-03 14:51 ` Solar Designer
2011-08-03 17:08 ` Luka Marčetić
2011-08-03 17:22 ` Rich Felker
2011-08-03 18:03 ` Luka Marčetić
2011-08-03 18:19 ` Rich Felker [this message]
2011-08-03 18:38 ` Luka Marčetić
2011-08-03 21:59 ` Luka Marčetić
2011-08-03 22:45 ` Solar Designer
2011-08-03 22:53 ` Rich Felker
2011-08-04 11:43 ` Luka Marčetić
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110803181908.GZ132@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).