Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: Problem compiling StreamDevice on Visual Studio 2015
From: Dirk Zimoch <dirk.zimoch@psi.ch>
To: Mark Rivers <rivers@cars.uchicago.edu>, "freddie.akeroyd@stfc.ac.uk" <freddie.akeroyd@stfc.ac.uk>
Cc: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Thu, 19 Jan 2017 16:37:09 +0100
Good to know.

The basic problem is that different OS want different format modifiers for size_t.

On Linux I need to use %zd, on vxWorks %d and on Windows %Id.

Is there a common way to handle this problem?

Dirk

On 19.01.2017 04:17, Mark Rivers wrote:
Hi Freddie,

Thanks, that fixed the problem.  The same fix is needed in 2 lines in StreamCore.cc.

Mark

________________________________
From: freddie.akeroyd@stfc.ac.uk [freddie.akeroyd@stfc.ac.uk]
Sent: Wednesday, January 18, 2017 7:31 PM
To: Mark Rivers; dirk.zimoch@psi.ch
Cc: tech-talk@aps.anl.gov
Subject: RE: Problem compiling StreamDevice on Visual Studio 2015

Hi Mark,

If you add some extra space around P I think it will work i.e.   result.print("%" P "d,%" P "d,%" P "d:\033[37m", offs, len, cap);
The additional spaces should not change the final string concatenation result

Regards,

Freddie


From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Mark Rivers
Sent: 19 January 2017 01:17
To: Mark Rivers; 'Dirk Zimoch'
Cc: tech-talk@aps.anl.gov
Subject: RE: Problem compiling StreamDevice on Visual Studio 2015

I just found that P is defined as:

#define P PRINTF_SIZE_T_PREFIX

The format string was changed in this commit:

****************************
commit 73cba130c32df2031a3d862ed9daf5ba00d5173b
Author: zimoch <zimoch>
Date:   Thu May 16 08:28:34 2013 +0000

    use ssize_t for signed index types. Win has no ssize_t, use ptrdiff_t instead.
    use P instead of S as shortcut for PRINTF_SIZE_T_PREFIX because some OK already use S.
****************************

which did this:

*********************************
-#define S PRINTF_SIZE_T_PREFIX
+#define P PRINTF_SIZE_T_PREFIX
…
-    result.print("%"S"d,%"S"d,%"S"d:\033[37m", offs, len, cap);
+    result.print("%"P"d,%"P"d,%"P"d:\033[37m", offs, len, cap);
*********************************

But that does not tell me how to fix it.

Thanks,
Mark


From: tech-talk-bounces@aps.anl.gov<mailto:tech-talk-bounces@aps.anl.gov> [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Mark Rivers
Sent: Wednesday, January 18, 2017 7:09 PM
To: 'Dirk Zimoch'
Cc: tech-talk@aps.anl.gov<mailto:tech-talk@aps.anl.gov>
Subject: Problem compiling StreamDevice on Visual Studio 2015

Hi Dirk and all,

The following line compiles OK on Visual Studio 2010, but fails on Visual Studio 2015:

    result.print("%"P"d,%"P"d,%"P"d:\033[37m", offs, len, cap);


This is the error:

cl -EHsc -GR                -nologo -D__STDC__=0 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE   -Ox -GL -Oy-   -W3 -w44355 -w44344        -MT  -TP  -I. -I../O.Common -I.
-I. -I.. -I../../../include/compiler/msvc -I../../../include/os/WIN32 -I../../../include      -IJ:/epics/support/asyn-4-31/include   -IJ:/epics/support/calc-3-6-1/include
-IJ:/epics/support/sscan-2-10-2/include -IH:/epics/base-3.15.5/include/compiler/msvc -IH:/epics/base-3.15.5/include/os/WIN32 -IH:/epics/base-3.15.5/include        -c ../StreamBuffer.cc
StreamBuffer.cc
../StreamBuffer.cc(317): error C3688: invalid literal suffix 'P'; literal operator or literal operator template 'operator ""P' not found
H:/epics/base-3.15.5/configure/RULES_BUILD:233: recipe for target 'StreamBuffer.obj' failed
make[1]: *** [StreamBuffer.obj] Error 2
make[1]: Leaving directory 'J:/epics/support/stream/StreamDevice/src/O.windows-x64-static-vs2015'
H:/epics/base-3.15.5/configure/RULES_ARCHS:58: recipe for target 'install.windows-x64-static-vs2015' failed
make: *** [install.windows-x64-static-vs2015] Error 2

Can someone explain what the P characters in that format string do, and how to get this to compile on Visual Studio 2015?

Thanks,
Mark



References:
Problem compiling StreamDevice on Visual Studio 2015 Mark Rivers
RE: Problem compiling StreamDevice on Visual Studio 2015 Mark Rivers
RE: Problem compiling StreamDevice on Visual Studio 2015 freddie.akeroyd
RE: Problem compiling StreamDevice on Visual Studio 2015 Mark Rivers

Navigate by Date:
Prev: RE: Problem NFS mounting Centos 7 file systems from vxWorks 5.5 Mark Rivers
Next: RE: CA server bind failure on Windows freddie.akeroyd
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: RE: Problem compiling StreamDevice on Visual Studio 2015 Mark Rivers
Next: Table properties in CSS BOY Shantonu Sahoo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 14 Feb 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·