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

Clean up vasprintf() usage #4347

Closed
wants to merge 1 commit into from

Conversation

derobins
Copy link
Member

@derobins derobins commented Apr 8, 2024

  • Remove HD from vasprintf()
  • Document that it's GNU/BSD, not POSIX
  • Minor tidying

* Remove HD from vasprintf()
* Document that it's GNU/BSD, not POSIX
* Minor tidying
@derobins derobins added Merge - To 1.14 Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Component - C Library Core C library issues (usually in the src directory) Type - Improvement Improvements that don't add a new feature or functionality labels Apr 8, 2024
Copy link
Contributor

@qkoziol qkoziol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change to make a macro of the same name as vasprintf() is going to be confusing and is the reason we put the HD prefix in place, so that users are aware that it isn't the system/library call. I would update the comments, but leave the HD prefix for this.

@derobins
Copy link
Member Author

derobins commented Apr 8, 2024

This change to make a macro of the same name as vasprintf() is going to be confusing and is the reason we put the HD prefix in place, so that users are aware that it isn't the system/library call. I would update the comments, but leave the HD prefix for this.

If the semantics are the same, should a developer care?

I can leave H5_ in front of the dozen or so calls that will be different on some platform, but that means that developers will have the cognitive overhead of remembering which random functions need the prefix. I think it's easier to say that we assume you have a POSIX system that conforms to POSIX.1-2008 and C99/C11 and that we'll do what it takes to fake that if you aren't compliant. vasprintf() is weird because it's GNU/BSD and not POSIX, so maybe we can do something different with that.

Like using H5_flock() or H5_(un)lock_file() for our file locking semantics is probably a good idea. Ditto H5_basename() since the semantics are not the same on all platforms. I'm not sure that people need to care that fseek() is _fseeki64() on Windows, though.

Basically, what I'm trying to do is the same thing that POSIX did with LFS.

@hyoklee
Copy link
Member

hyoklee commented Apr 10, 2024

This change to make a macro of the same name as vasprintf() is going to be confusing and is the reason we put the HD prefix in place, so that users are aware that it isn't the system/library call. I would update the comments, but leave the HD prefix for this.

Thanks for the explanation, @qkoziol! I was always curious about the long history of HD prefix.

@derobins
Copy link
Member Author

Closing this. We've decided to keep HD as a prefix for anything that might be a work-around.

@derobins derobins closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Type - Improvement Improvements that don't add a new feature or functionality
Projects
Status: Merges Complete
Development

Successfully merging this pull request may close these issues.

5 participants