Skip to content

Add comments about internal headers #15689

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

Merged
merged 1 commit into from
Sep 8, 2024
Merged

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Sep 1, 2024

A common convention is to name internal C header files as *_int.h. Since a couple of these are actually installed, we add comments that this is not supposed to happen, (a) to avoid installing further internal headers, and (b) to pave the way to fix this in the next major PHP version.

Somewhat special is php_gmp_int.h, where "int" is meant as abbreviation for "interface".

Another common convention is appending _priv or _private, but since there have not been any issues regarding these headers so far, we refrain from adding respective comments to these headers.

Anyhow, it might be a good idea to introduce some common naming convention for such internal/private headers.


See also #15688.

A common convention is to name internal C header files as `*_int.h`.
Since a couple of these are actually installed, we add comments that
this is not supposed to happen, (a) to avoid installing further
internal headers, and (b) to pave the way to fix this in the next major
PHP version.

Somewhat special is php_gmp_int.h, where "int" is meant as abbreviation
for "interface".

Another common convention is appending `_priv` or `_private`, but since
there have not been any issues regarding these headers so far, we
refrain from adding respective comments to these headers.

Anyhow, it might be a good idea to introduce some common naming
convention for such internal/private headers.
@jorgsowa
Copy link
Contributor

jorgsowa commented Sep 1, 2024

Somewhat special is php_gmp_int.h, where "int" is meant as an abbreviation for "interface".

Shouldn't the file be named php_gmp_interface.h to avoid the confusion?

@petk
Copy link
Member

petk commented Sep 1, 2024

Semi-related note: I've also "read" the ..._int.h as integer. Yes, abbreviations are not that commonsensical as it may seem.

@cmb69
Copy link
Member Author

cmb69 commented Sep 1, 2024

Shouldn't the file be named php_gmp_interface.h to avoid the confusion?

Either that, or php_gmp.h should be renamed tog php_gmp_int.h and php_gmp_int.h to php_gmp.h. However, the file is installed (aka. public) for 7 years, so that would be a BC break (extensions including the file would need to be changed to be able to be built, and would need `#if's to cater to both names), and I wouldn't want to do that for PHP 8.4 (just a bit late), and probably only for a major PHP version (where more serious changes have to be expected by extension authors anyway).

@cmb69 cmb69 merged commit 50b3a0d into php:master Sep 8, 2024
10 checks passed
@cmb69 cmb69 deleted the cmb/int-headers branch September 8, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants