Hi On Fri, Aug 15, 2014 at 12:29 PM, Thomas H.P. Andersen <pho...@gmail.com> wrote: > On Fri, Aug 15, 2014 at 11:49 AM, David Herrmann <dh.herrm...@gmail.com> > wrote: >> Thanks for trying! >> >> Result is as I expected. Evaluation takes place _after_ validating >> compile-time constants, and thus __builtin_constant_p in combination >> with ?: will not work if not both cases are constant. Maybe it works >> with __builtin_choose_expr()? >> >> Can you try the attached patch? > > This patch works. It also needs the change to do the calculation to a > seperate line. Also only if size is const, like so: > const size_t size = MAX(sizeof(struct in_pktinfo), sizeof(struct > in6_pktinfo));
Again, thanks for trying it out! I don't understand your comment, though. You're saying this works: const size_t size = MAX(...); uint8_t buffer[CMSG_SPACE(size) +...]; ...but this doesn't work: uint8_t buffer[CMSG_SPACE(MAX(...)) +...]; ...and this doesn't work either (mind the dropped 'const'): size_t size = MAX(...); uint8_t buffer[CMSG_SPACE(size) +...]; Hm. This is weird. Maybe CMSG_SPACE does something weird. I'll see. David _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel