Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pool buffers should not use uint32* as interface type #1021

Closed
jphickey opened this issue Nov 16, 2020 · 0 comments · Fixed by #1025 or #1045
Closed

Pool buffers should not use uint32* as interface type #1021

jphickey opened this issue Nov 16, 2020 · 0 comments · Fixed by #1025 or #1045
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The ES memory pool API uses uint32* as a buffer pointer - this is the type used in CFE_ES_GetPoolBuf() and CFE_ES_PutPoolBuf() among others.

This presents a few usability problems:

  • Most often the data being stored is not actually uint32 - so it generally needs to be type cast by the user.
  • Typecasts are ugly and risky
  • Specifically - Typecasts to/from uint32* might create a warning about alignment on some platforms (one direction or the other is likely to be seen as an upgrade in alignment requirement)
  • If alignment was the goal, 32 bits is still too low for double type, or a 64-bit pointer, so it fails at that job.

Describe the solution you'd like
The API should use void*.

Additional context
Although this basically turns off type checking, there was no real type checking here to begin with, and pool buffers intentionally should be convertible to any type, so no need for it here anyway.

Using void* will clean up the code substantially, allowing a lot of unnecessary type casts to be removed.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Nov 16, 2020
jphickey added a commit to jphickey/cFE that referenced this issue Nov 18, 2020
Using void* instead of uint32* here makes the interface
easier to use and may avoid some nuisance alignment warnings.
jphickey added a commit to jphickey/cFE that referenced this issue Dec 2, 2020
Using void* instead of uint32* here makes the interface
easier to use and may avoid some nuisance alignment warnings.
astrogeco added a commit that referenced this issue Dec 7, 2020
@astrogeco astrogeco added this to the 7.0.0 milestone Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants