On Tue, Feb 18, 2025 at 06:12:04PM +0100, Morten Brørup wrote: > > From: Andre Muezerie [mailto:andre...@linux.microsoft.com] > > Sent: Tuesday, 18 February 2025 17.32 > > > > There's no MSVC equivalent for compiler extension __builtin_constant_p. > > EAL already had __rte_constant which was used as a first attempt to > > workaround __builtin_constant_p when using MSVC. However, there are > > pieces of code that would benefit from being able to provide a default > > value to be used instead of it being always 0 like how it was done by > > __rte_constant. > > > > A new macro is added here allowing such default to be provided by the > > caller. > > NAK to the new macro. > > Please use the sizeof() hack suggested by Stephen to provide an > implementation of __rte_constant(e) for MSVC. > Here's a link to an example of the hack: > https://news.ycombinator.com/item?id=16720172
Thanks for the link. I tried to use the hack as suggested but turns out it does not work with msvc. It results in error C2100: "you cannot dereference an operand of type 'void'". I'm open to further suggestions.