g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014 
<== Date ==> <== Thread ==>

Subject: Re: double buffered waveformRecord
From: Andrew Johnson <anj@aps.anl.gov>
To: mdavidsaver@bnl.gov
Cc: core-talk@aps.anl.gov
Date: Thu, 10 Jan 2013 15:57:31 -0600
Hi Michael,

Just tidying up some loose ends...

On 2013-01-04 Michael Davidsaver wrote:
> Also, I know what I am doing breaks with the arr (array slicing) channel
> plugin, which assumes the offset will always be [0, NELM).

It would be good to put some protection into that plugin if it doesn't already 
have it, so it won't do anything explosive in this kind of circumstance.

> I am curious though about what 'differently allocated buffers' mean wrt.
> the C standard?

I believe the standard says that you're not allowed to do pointer arithmetic 
that will result in pointer values that would fall before the first element or 
after the last+1 element of a memory block.  Now for the architectures we're 
working with there's no real problem with doing this, but in some of the more 
exotic architectures pointers are more complicated than holding just a memory 
address, and they are the reason for this rule.

I can't quote chapter and verse from the C standard, but in the C++98 one 
section 5.7 says about pointer subtraction "Unless both pointers point to 
elements of the same array object, or one past the last element of the array 
object, the behavior is undefined."

> For the pointer which would live permenently in DBADDR and be used for
> db_post_events() and similar, I was considering using
> '(void*)&prec->bptr'.  If it isn't being dereferenced then it is just an
> identifier.

&prec->val is actually more logical (the waveform record really doesn't need a 
separate BPTR field, it could use VAL instead.  That's what the aSub record 
does, but it's too late to fix waveform now.

- Andrew
-- 
There is no such thing as a free lunch.  When invited for lunch,
it is best to check if you are there to eat, or to be eaten.
-- Clive Robinson

Replies:
Re: double buffered waveformRecord Ralph Lange
References:
double buffered waveformRecord Michael Davidsaver
Re: double buffered waveformRecord Andrew Johnson
Re: double buffered waveformRecord Michael Davidsaver

Navigate by Date:
Prev: Re: double buffered waveformRecord Michael Davidsaver
Next: Re: double buffered waveformRecord Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014 
Navigate by Thread:
Prev: Re: double buffered waveformRecord Michael Davidsaver
Next: Re: double buffered waveformRecord Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·