10 Apr
2025
10 Apr
'25
10:42 a.m.
On Mon Apr 7 10:02:30 2025 +0000, Piotr Caban wrote:
While this code does what you want it looks non portable / over complicated. At least __xy type should be changed to something like: ```c #define __CMPLX(x, y, t, t2) \ ((union { t __z; t2 __xy[2]; }){.__xy = {(x),(y)}}.__z) #define CMPLX(x, y) __CMPLX(x, y, _Dcomplex, double) ``` It could be simplified even further to: ```c #define __CMPLX(x, y, t) ((t){(x), (y)}) ``` I'm afraid that none of this code is portable (at least it will not compile with MSVC). It's probably best to define the macros using `_Cbuild` and `_FCbuild` functions:
#define CMPLX(x, y) _Cbuild(x, y)
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7748#note_100545