Deutsch English Français Italiano |
<86ttka1p61.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!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: Help requested with P99-based macro to create Wayland listeners Date: Tue, 09 Apr 2024 09:22:46 -0700 Organization: A noiseless patient Spider Lines: 20 Message-ID: <86ttka1p61.fsf@linuxsc.com> References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 09 Apr 2024 16:22:49 +0200 (CEST) Injection-Info: dont-email.me; posting-host="47558c70f7e061adbec47d824d7ff660"; logging-data="357568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sNQST51cm+PsX32UoXL7Pl6JD5y0Z8j4=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:ouCu+jNWh30QwYavks1nq6pR02g= sha1:YZfn90K7ibo1+LuwgtkqzJWXbz0= Bytes: 1961 Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes: > This macro doesn't work and i don't know why. I've tried multiple > different things to try to delay the expansion of _0MAKE_LISTENER and none > of them have worked. I don't know if there's a more idiomatic way to do > this. I've tried looking at the output from putting it through ?cpp? and > that didn't work because it errored out before i could see what it > expanded to. > > #define MAKE_LISTENER(object_type, ...) static const struct\ > object_type##_listener object_type##_listener = { P99_SEQ(\ > _0MAKE_LISTENER, P99_SEQ((object_type), __VA_ARGS__)) } > #define _0MAKE_LISTENER(x) _1MAKE_LISTENER (x, _2MAKE_LISTENER > #define _1MAKE_LISTENER _3MAKE_LISTENER > #define _2MAKE_LISTENER(y) y) > #define _3MAKE_LISTENER _4MAKE_LISTENER > #define _4MAKE_LISTENER(object_type, event_name) .event_name =\ > callback_##object_type##_##event_name What is it that you want to accomplish?