Experimental Physics and Industrial Control System
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
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- 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
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024