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 [email protected]
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: [email protected] [mailto:[email protected]]
> 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
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- 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
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|