> 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.
>
> http://www.cplusplus.com/forum/beginner/173925/
>
> 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) www.bnl.gov/nsls2 <http://www.bnl.gov/nsls2>
>
>
>
- Replies:
- RE: sizeof with g++ > 5.2 Gofron, Kazimierz via Core-talk
- References:
- sizeof with g++ > 5.2 Gofron, Kazimierz via Core-talk
- Navigate by Date:
- Prev:
sizeof with g++ > 5.2 Gofron, Kazimierz via Core-talk
- Next:
RE: sizeof with g++ > 5.2 Gofron, Kazimierz 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:
sizeof with g++ > 5.2 Gofron, Kazimierz via Core-talk
- Next:
RE: sizeof with g++ > 5.2 Gofron, Kazimierz 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
|