EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  <19961997  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  Index 1994  1995  <19961997  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 
<== Date ==> <== Thread ==>

Subject: Problem with sync groups and C++ clients
From: Guy Jennings <[email protected]>
To: [email protected]
Date: Wed, 06 Nov 1996 11:47:42 -0600
Epics folk:

I recently ran into a problem while attempting to use a sync group from
a C++ client application.  The code below is based on acctst.c in the
epics
distribution.

	/* int ca_sg_create(const unsigned int *g); */

	int	status;
	CA_SYNC_GID	gid=0;  /* const unsigned int gid = 0; */

	printf("Initially %ud\n", gid);

	status = ca_sg_create(&gid);
	SEVCHK(status, NULL);

	printf("Then %ud\n", gid);

If compiled with gcc the code works fine, with the ca_sg_create call
initialising
'gid' to a non-zero value (45 in my case).  If compiled with g++ the
code does not
work correctly and 'gid' retains the value 0 after the call to
ca_sg_create.  This
appears to be due to the definition of CA_SYNC_GID as 'const unsigned
int'. I think
it would be safer to remove the const from the typedef for CA_SYNC_GID
since at
present you are relying on undefined behavior - (typecasting away the
const in 
ca_sg_create).

As far as I can tell, CA_SYNC_GID is the only epics-defined type which
displays this
problem and the header already allows for CA_SYNC_GID not to be 'const'

Guy Jennings
BESSRC CAT
Argonne National Laboratory


Replies:
Re: Problem with sync groups and C++ clients Jeff Hill

Navigate by Date:
Prev: seqChanShow switches Sean Prior
Next: Re: Problem with sync groups and C++ clients Jeff Hill
Index: 1994  1995  <19961997  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: Re: seqChanShow switches Rozelle Wright
Next: Re: Problem with sync groups and C++ clients Jeff Hill
Index: 1994  1995  <19961997  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 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·