Thanks Michael,
The pull request fixing it for Eiger was created. If there is a better solution, it would be good to implement it.
https://github.com/areaDetector/ADEiger/pull/35
Kazimierz
-----Original Message-----
From: Michael Davidsaver <mdavidsaver at gmail.com>
Sent: Wednesday, 4 March 2020 1:38 PM
To: Gofron, Kazimierz <kgofron at bnl.gov>
Cc: core-talk at aps.anl.gov
Subject: Re: sizeof with g++ > 5.2
> mPollQueue(1, sizeof(acquisition_t))
https://github.com/search?q=org%3AareaDetector+mPollQueue&type=Code
So you're asking about byte-wise copying a std::string into an epicsMessageQueue?
This is, and has always been, a really bad idea. It isn't safe to mix C and C++ like this. You'll need to use something other than epicsMessageQueue, or replace use of std::string with a plain char[].
I generally use a combination of std::deque, an epicsEvent, and an epicsMutex to keep it all reentrant.
On 3/4/20 10:22 AM, Gofron, Kazimierz via Core-talk wrote:
> Hi,
>
> Since base is written in C, and many drivers are written in C++, we are seeing some issues for string, as discussed below.
>
> https://epics.anl.gov/tech-talk/2020/msg00515.php
>
>
>
> The g++ on Debian9 uses newer compiler than g++ > 5.2, and reports sizeof(string) up to 15.
>
> https://urldefense.com/v3/__http://www.cplusplus.com/forum/beginner/17
> 3925/__;!!P4SdNyxKAPE!XlzJJcWrnHxeg7alin7yo19b8wyTCIqz5vH09d9rgjKYVub2
> plQCLzhbjdfqBvID$
>
> sizeof(std::string), in-object space for small string storage:
> ```
> GNU libstdc++ (conforming implementation, GCC 5.2 or later): *32, 15*
> LLVM libc++: *24, 22* Microsoft msc++ 19.00 (VS 2015): *28, 15*
>
> *```*
>
>
>
> Is there a replacement / better way to use sizeof?
>
> mPollQueue(1, sizeof(acquisition_t))
>
>
>
> Kazimierz Gofron
>
> NSLS-II Controls Group
>
> Brookhaven National Laboratory
>
> (p) +1 (631) 344 5283
>
> (f) +1 (631) 344 8085
>
> (e) kgofron at bnl.gov <mailto:kgofron at bnl.gov>
>
> (w) http://www.bnl.gov/nsls2 <http://www.bnl.gov/nsls2>
>
>
>
- References:
- sizeof with g++ > 5.2 Gofron, Kazimierz via Core-talk
- Re: sizeof with g++ > 5.2 Michael Davidsaver via Core-talk
- Navigate by Date:
- Prev:
Re: sizeof with g++ > 5.2 Michael Davidsaver via Core-talk
- Next:
Build failed: epics-base base-epicsTempFile-C-11 AppVeyor via Core-talk
- 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: sizeof with g++ > 5.2 Michael Davidsaver via Core-talk
- Next:
Build failed: epics-base base-epicsTempFile-C-11 AppVeyor via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
|