From: Erik L. <eri...@gm...> - 2025-07-01 14:35:41
|
Hi Ethan, There is no objection from the macOS side: The compiler I use to generate universal binaries defaults to c17/c++17. Let me know if you wish me to try out a development version. Best, Erik On Tue, Jul 1, 2025 at 1:32 AM Ethan A Merritt <me...@uw...> wrote: > Bug reports 2812 and 2813 report and diagnose a problem with color-handling > that manifests on ARM architectures but not on x86. More detail is > attached > to bug 2812 if you want gory details. > > The basic issue is that different code is needed if color is represented by > a signed integer (e.g. "plot foo lt 2") or by an unsigned 32-bit ARGB value > (e.g. "splot foo with pm3d fillstyle transparent solid 0.25"). > > It is possible to modify the code by inserting an appropiate cast to either > color.lt = (int)value or color.lt = (unsigned int)value > everywhere that it matters. > > However IMO a cleaner approach is to modify the t_colorspec structure > using an anonymous union to distinguish between the two cases: > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > typedef struct t_colorspec { > colortype type; /* TC_<type> definitions below */ > union { > int lt; /* used for TC_LT, > TC_LINESTYLE */ > unsigned rgbcolor; /* used for TC_RGB */ > }; > double value; /* used for TC_CB and TC_FRAC */ > } t_colorspec; > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > That allows to write code like > if (color.type == TC_RGB) > color.rgbcolor = value; > else > color.lt = value; > I have a tested this out in a private git branch and it works as intended. > > HOWEVER, anonymous unions were only added to the C standard in C11, > although both gcc and clang already supported them well before that. > > So the question is, is it worth adding a requirement for C compiler that > supports > C11 or at least supports anonymous unions? > As of gnuplot version 6 we're requiring c99 (version 5 was ok with c89). > MSVisualStudio claims to support c11 as of 2019. I don't know what other > compilers people might be using, or what their level of support might be. > > What do you think? > Add it to the development version and back it out if compiler problems > are reported? What about the stable version? > > Ethan > > > > > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > Membership management via: > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > |