From: Michael Witten Date: Wed, 30 Mar 2011 15:02:28 GMT Subject: Re: [RFC 2/2] Future Proofing: Pass around pointers to either functions or data Message-ID: <429c193b-6bc6-4f13-bd69-af113a4bd145-mfwitten@gmail.com> In-Reply-To: On Wed, 30 Mar 2011 12:09:46 +0200, Erik Faye-Lund wrote: > On Tue, Mar 29, 2011 at 5:28 PM, Michael Witten wrote: >> +#define ALT_ODB_FN_INFO_FUNC(variable, function) \ >> + union alt_odb_fn_info variable = { \ >> + .func = (alt_odb_fn_cb)function \ >> + } >> +#define ALT_ODB_FN_INFO_DATA(variable, data_) \ >> + union alt_odb_fn_info variable = { \ >> + .data = data_ \ >> + } > > We try to stay away from C99 features like this, as it doesn't work on > all compilers we target. How about changing it to this: #define ALT_ODB_FN_INFO_FUNC(variable, function) \ union alt_odb_fn_info variable; do { \ variable.func = (alt_odb_fn_cb)function; \ } while (0) #define ALT_ODB_FN_INFO_DATA(variable, data_) \ union alt_odb_fn_info variable; do { \ variable.data = data_ \ } while (0)