Hi Arjen:

I am addressing you because you are our primary Windows platform
expert, but I would be happy to hear from others here as well
(including Alaric) with some knowledge of that platform.

What would be your advice concerning replacing our use of the WIN32
and __WIN32__ macros in our source code?

Basically, Alaric (see his bug report below) has found a platform where the 
_WIN32 macro is #defined
but not WIN32, and the stackoverflow discussion he referenced appears to
say the two macros ordinarily have the same meaning but the underscored
one is a bit safer to use because there is a convention it should not be
changed by anyone other than the compiler vendor.

Note, however, that Alaric's bug report does not cover the entire
problem in our code because we also make use of the __WIN32__ macro.
Another stackoverflow discussion concerning that macro referenced
<https://web.archive.org/web/20140625123925/http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system>.

My conclusion from reading the "Windows, Cygwin (non-POSIX), and
MinGW" section of that article is the safest course for supporting all
Windows compilers is for us to replace all use of the WIN32 and
__WIN32__ macros in our C and C++ code with use of the _WIN32 macro
instead.  Do you agree?

If so, I would be willing to take responsibility for
the actual code change since Linux has excellent facilities (find and
sed) for automatic mass-editing of code.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

---------- Forwarded message ----------
Date: Mon, 09 Oct 2017 15:52:10 +0000
From: Alaric Senat <alaric1...@users.sf.net>
Reply-To: Ticket 189 <1...@bugs.plplot.p.re.sf.net>
To: Ticket 189 <1...@bugs.plplot.p.re.sf.net>
Subject: [plplot:bugs] #189 Using WIN32 Macro instead of _WIN32




---

** [bugs:#189] Using WIN32 Macro instead of _WIN32**

**Status:** open
**Group:**
**Created:** Mon Oct 09, 2017 03:52 PM UTC by Alaric Senat
**Last Updated:** Mon Oct 09, 2017 03:52 PM UTC
**Owner:** nobody


Hello,

This ticket is just about a little detail and its not exactly a bug.
Me and my team are cross-compiling for windows, and we noticed that you are 
often using the WIN32 macro in your source files to check the current 
compilator platform.
We needed to switch these macros to \_WIN32 because in our case, we are 
compiling with the *-std=c++14* flag and is disable WIN32 cause it's not in the 
standard.
To my mind, It would be a bit safer if those WIN32 were switched to \_WIN32 in 
a further version of PlPlot!

Here is a nice topic on that point : 
https://stackoverflow.com/questions/662084/whats-the-difference-between-the-win32-and-win32-defines-in-c/662543#662543

Regards,
Alaric Senat


---

Sent from sourceforge.net because you indicated interest in 
<https://sourceforge.net/p/plplot/bugs/189/>



To unsubscribe from further messages, please visit 
<https://sourceforge.net/auth/subscriptions/>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to