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  <20112012  2013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: RE: epicsTypes.h/inttypes.h question
From: "Jeff Hill" <johill@lanl.gov>
To: "'Till Straumann'" <strauman@slac.stanford.edu>, "'EPICS Techtalk'" <tech-talk@aps.anl.gov>
Date: Fri, 27 May 2011 09:39:11 -0600
Hi Till,

> C99 has stdint.h/inttypes.h. Under EPICS OSI
> we are supposed to use epicsTypes.h.
> However, epicsTypes.h lacks the printf and
> scanf formats which inttypes.h defines.
> 
> How are we supposed to code portable formats
> when using epicsTypes.h ?

Actually, the epics types are based on the C99 types, when that compiler is
available and in use (it didn?t used to be omnipresent). It's quite common
to make typedef aliases of the C/C99 types for maintainability and
readability purposes.

#if __STDC_VERSION__ >= 199901L
    typedef int8_t          epicsInt8;
    typedef uint8_t         epicsUInt8;
    typedef int16_t         epicsInt16;
    typedef uint16_t        epicsUInt16;
    typedef epicsUInt16     epicsEnum16;
    typedef int32_t         epicsInt32;
    typedef uint32_t        epicsUInt32;
    typedef int64_t         epicsInt64;
    typedef uint64_t        epicsUInt64;
#else

I suppose that we could invent epicsPRId16 to be used with epicsInt16, this
would be needed only if we were concerned about losing int16_t and
epicsInt16 equivalency, which is probably (hopefully) unlikely.

#define epicsPRId16 PRId16

Also, check out Harbinson and Steele chapter 6.3.5 about conversion of
arguments to canonical types when the function lacks a prototype, or the
function prototype has "..." variable arguments.

Jeff
______________________________________________________
Jeffrey O. Hill           Email        johill@lanl.gov
LANL MS H820              Voice        505 665 1831
Los Alamos NM 87545 USA   FAX          505 665 5107

Message content: TSPA

With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead. -- RFC 1925


> -----Original Message-----
> From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov]
> On Behalf Of Till Straumann
> Sent: Thursday, May 26, 2011 4:54 PM
> To: EPICS Techtalk
> Subject: epicsTypes.h/inttypes.h question
> 
> C99 has stdint.h/inttypes.h. Under EPICS OSI
> we are supposed to use epicsTypes.h.
> However, epicsTypes.h lacks the printf and
> scanf formats which inttypes.h defines.
> 
> How are we supposed to code portable formats
> when using epicsTypes.h ?
> 
> Thanks
> -- Till



References:
epicsTypes.h/inttypes.h question Till Straumann

Navigate by Date:
Prev: Re: Parallel States Sequencer Ned Arnold
Next: RE: Problems with executing caExample for 3.14.12.1 Cid, Florencio A
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: epicsTypes.h/inttypes.h question Till Straumann
Next: HV PSU suggestions tom.cobb
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·