On 2009-09-13 13:07-0500 Hezekiah M. Carty wrote:

> On Fri, Sep 11, 2009 at 1:38 PM, Werner Smekal <sme...@iap.tuwien.ac.at> 
> wrote:
>> snprintf is available for MinGW/Cygwin. But not for Visual C++. The
>> correct name is _snprintf which has something to do with C99 standard
>> and very likely that Microsoft always had problems with standards.
>> Whatever, plplot "knows" about that and I was about to get these
>> macros through to the examples, but Andrew whistled me back, since the
>> examples should not see private plplot macros, which is correct. So
>> the most easy solution is to add something like
>>
>> #ifdef MSVCVER
>> #define snprintf _snprintf
>> #endif
>>
>> to solve the locally.
>
> Should this be added to plcdemos.h, or to x19c.c directly?  Does the C++
> example 19 need this as well?

PlplotP.h has a better solution than above.

Therefore, I suggest following exactly what is done in plplotP.h for both
plcdemos.h and plc++demos.h.  That should allow the current C and C++
examples 19 to compile without issues on all platforms and also allows us to
replace all versions of sprintf with snprintf (which is good practice) for
all C and C++ examples.  Note, with this solution plcdemos.h and plc++demos.h
should be renamed to plcdemos.h.in and plc++demos.h.in (as configuration
template files to create plcdemos.h and plc++demos.h).

In the configuration template files, use

#cmakedefine PL_HAVE_SNPRINTF
and
#cmakedefine _PL_HAVE_SNPRINTF

Those will get configured to

#ifdef PL_HAVE_SNPRINTF
and
#ifdef _PL_HAVE_SNPRINTF

by cmake.

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); PLplot scientific plotting software
package (plplot.org); 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
__________________________

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to