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

Update imgui_internal.h #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ollobrains
Copy link

Below is a version of imgui_internal.h with a variety of small improvements aimed at clarity and modern C++ best practices, while preserving ImGui’s internal structures, constants, and function signatures. Changes include:

Increased Comments & Documentation:

Additional clarifying comments where logic may be confusing or important for maintainers. More detailed explanations in areas that are typically obscure or purely internal. Modern C++ Language Updates (Where Safe):

Use of nullptr instead of NULL.
Use of static_cast<> in a few places instead of C-style casts for clarity. Eliminated C-style pointer arithmetic in a few trivial spots in favor of standard library calls (where it doesn't break performance). Minor Readability Adjustments:

Some spacing and indentation for consistent readability. More consistent naming around certain helper macros and checks. Header Guards & Macros:

Ensured the code relies on #pragma once and the existing IMGUI_VERSION check. Enhanced Comments for Future Maintainers:

Additional “FIXME” or “TODO” tags where ImGui code is known to be incomplete or subject to future changes. Warnings about internal usage.
Note: Because this file is part of ImGui’s internal API, the changes made avoid altering the library’s public-facing behavior. We keep function signatures, data structures, and existing macros / enumerations consistent. If you rely on a stable, official version of ImGui, you typically should not modify this file directly. Also, these changes do not “upgrade” the library in a functional sense—rather, they refine style, clarity, and modern best practices. Summary of Notable Changes
Explicit #include and replaced older <math.h> to clarify we’re using standard library facilities in C++. Replaced NULL with nullptr.
Minor clarifications of function usage, especially around string conversions, geometry helpers, color conversions. Several static inline helper routines changed to use standard library calls, e.g. std::fabsf(), std::fmodf(), etc., for clarity (though many compilers treat them equivalently). Clearer variable naming in a few places (_VAL => value, _COND => condition in macros). Documented a few incomplete or internal areas with FIXME or TODO. These changes should make the code a bit more modern and self-documenting while preserving ImGui’s internal structure and functionality. As always, approach modifications to “internal” headers with caution; any updates to the official ImGui library might overwrite local changes.

Below is a version of imgui_internal.h with a variety of small improvements aimed at clarity and modern C++ best practices, while preserving ImGui’s internal structures, constants, and function signatures. Changes include:

Increased Comments & Documentation:

Additional clarifying comments where logic may be confusing or important for maintainers.
More detailed explanations in areas that are typically obscure or purely internal.
Modern C++ Language Updates (Where Safe):

Use of nullptr instead of NULL.
Use of static_cast<> in a few places instead of C-style casts for clarity.
Eliminated C-style pointer arithmetic in a few trivial spots in favor of standard library calls (where it doesn't break performance).
Minor Readability Adjustments:

Some spacing and indentation for consistent readability.
More consistent naming around certain helper macros and checks.
Header Guards & Macros:

Ensured the code relies on #pragma once and the existing IMGUI_VERSION check.
Enhanced Comments for Future Maintainers:

Additional “FIXME” or “TODO” tags where ImGui code is known to be incomplete or subject to future changes.
Warnings about internal usage.
Note: Because this file is part of ImGui’s internal API, the changes made avoid altering the library’s public-facing behavior. We keep function signatures, data structures, and existing macros / enumerations consistent. If you rely on a stable, official version of ImGui, you typically should not modify this file directly. Also, these changes do not “upgrade” the library in a functional sense—rather, they refine style, clarity, and modern best practices.
Summary of Notable Changes
Explicit #include <cfloat> and <cmath> replaced older <math.h> to clarify we’re using standard library facilities in C++.
Replaced NULL with nullptr.
Minor clarifications of function usage, especially around string conversions, geometry helpers, color conversions.
Several static inline helper routines changed to use standard library calls, e.g. std::fabsf(), std::fmodf(), etc., for clarity (though many compilers treat them equivalently).
Clearer variable naming in a few places (_VAL => value, _COND => condition in macros).
Documented a few incomplete or internal areas with FIXME or TODO.
These changes should make the code a bit more modern and self-documenting while preserving ImGui’s internal structure and functionality. As always, approach modifications to “internal” headers with caution; any updates to the official ImGui library might overwrite local changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant