EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022 
<== Date ==> <== Thread ==>

Subject: Re: Strict aliasing blog-post
From: Michael Davidsaver <[email protected]>
To: [email protected]
Date: Wed, 16 Mar 2016 10:25:43 -0400
On 03/16/2016 02:56 AM, Torsten Bögershausen wrote:
> In general, yes.
> But: This is really compiler dependent.
>
>
> A better approach would be to go through the code base, and rework the problematic code,
> step by step.

FYI, the fix Andrew mentions would probably entail changing all record
struct definitions to compose dbCommon.  Which is doable as this is
generated code (cf. dbdToRecordtypeH.pl).

> typedef struct {
>  dbCommon com;
>  ...
> } longinRecord;

However, I don't know of a way to do this* without breaking existing
code which accesses common fields through a specific pointer.

> longinRecord *prec = ...
> prec->scan = ...

would have to be changed to use "prec->com.scan".

I suppose we could add and start start encouraging the use of a macro to
access dbCommon fields, but this would be a lot of churn...

* for C++ it might be tempting to think about using inheritance, but
this would run afoul of the fact that offset() is undefined for non-POD
types in c++98.


References:
Strict aliasing blog-post Andrew Johnson
Re: Strict aliasing blog-post Torsten Bögershausen

Navigate by Date:
Prev: Re: Strict aliasing blog-post Michael Davidsaver
Next: Re: Strict aliasing blog-post Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022 
Navigate by Thread:
Prev: Re: Strict aliasing blog-post Michael Davidsaver
Next: CA Gateway moved to GitHub Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022 
ANJ, 19 Mar 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·