EPICS Controls 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  2021  2022  2023  2024  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  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: aSub and zero length arrays
From: Andrew Johnson <[email protected]>
To: [email protected], [email protected]
Date: Tue, 18 Oct 2011 10:30:03 -0500
Hi Michael,

On 2011-10-18 Michael Davidsaver wrote:
> I've stumbled onto an interesting behavior of aSub.  I want to write a
> function which takes a CHAR array as input (a long string).  Sometimes
> the string can legitimately be empty (length 0).  What I find is that
> when the the input should go from non-empty to empty it does not, and
> instead keeps the previous value.

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.

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

Replies:
long strings Michael Davidsaver
Re: aSub and zero length arrays Michael Davidsaver
References:
aSub and zero length arrays Michael Davidsaver

Navigate by Date:
Prev: aSub and zero length arrays Michael Davidsaver
Next: RE: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana
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  2021  2022  2023  2024 
Navigate by Thread:
Prev: aSub and zero length arrays Michael Davidsaver
Next: long strings Michael Davidsaver
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  2021  2022  2023  2024 
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 ·