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  2020  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  2020 
<== Date ==> <== Thread ==>

Subject: Re: aSub and zero length arrays
From: Andrew Johnson <anj@aps.anl.gov>
To: mdavidsaver@bnl.gov
Cc: tech-talk@aps.anl.gov
Date: Tue, 18 Oct 2011 12:42:52 -0500
Hi Michael,

On 2011-10-18 Michael Davidsaver wrote:
> On 10/18/2011 11:30 AM, Andrew Johnson wrote:
> > The number of elements of a long string (char array) must always include
> > the terminating nil character, thus an empty string must have an element
> > count of one, not zero.  If you don't include the terminator in your
> > element count your string might get old garbage appended to it.
> 
> Ok, so this covers the case of long strings.  What about other types
> (eg. DOUBLE)?  Isn't this an issue of general correctness/proper error
> reporting?

I believe there are a number of places in the dbAccess code that can't handle 
zero-length arrays.  Passing a zero element count sometimes means just process 
the attributes (alarm, timestamp etc.), don't copy any data elements at all; a 
second call is used to access the data elements in those cases.

I'm not saying this is how I'd /like/ it to work, but it is how I believe some 
parts of the code currently operate.

- Andrew
-- 
Optimization is the process of taking something that works and
replacing it with something that almost works, but costs less.
-- Roger Needham

References:
aSub and zero length arrays Michael Davidsaver
Re: aSub and zero length arrays Andrew Johnson
Re: aSub and zero length arrays Michael Davidsaver

Navigate by Date:
Prev: RE: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana
Next: Build EPICS base-3.14.12.1-T222 in Linux problem. Chen Xue
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  2020 
Navigate by Thread:
Prev: Re: aSub and zero length arrays Michael Davidsaver
Next: Build EPICS base-3.14.12.1-T222 in Linux problem. Chen Xue
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  2020 
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 ·