Experimental Physics and
| |||||||||||||||||
|
Hi Mark,
Actually you are passing a pointer to a 26-char array, so the compiler is warning you that what you’re doing isn’t strictly legal. I briefly looked at this code and these warnings on RHEL-8 a few weeks ago. The
setEnums() routine takes a
char *outStrings pointer that you point to one field in a struct (record), and you made the code inside
setEnums() rely on the fact that this field is immediately followed by another identical field (for a binary record) or 15 more of them (multi-bit binary):
or
The modern C standard says that you aren’t supposed to access data beyond the end of the object that you pointed to, even if you know how the compiler laid out the parent structure in memory. Sometimes I want to go back to writing BCPL or Forth…
It is possible to change the first argument to setEnums() to be something like a char (*names)[16][26] where the first dimension is the field index, but unless
setEnums() gets moved into a different .c file and compiled separately from the routines that call it the compiler still knows that you’re passing it a pointer derived from
znam but accessing
onam through it:
I don’t have a solution, but I’m attaching my patch that reduces the errors (slightly) to the above. I’m not convinced it’s correct.
- Andrew
On Sep 16, 2020, at 8:47 PM, Mark Rivers via Core-talk <core-talk at aps.anl.gov> wrote:
--
Complexity comes for free, simplicity you have to work for.
Attachment:
asyn-enum.patch
| ||||||||||||||||
ANJ, 17 Sep 2020 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |