Skip to content

[PWGDQ] Fix casts - #18386

Draft
vkucera wants to merge 1 commit into
AliceO2Group:masterfrom
vkucera:cast-PWGDQ
Draft

vkucera wants to merge 1 commit into
AliceO2Group:masterfrom
vkucera:cast-PWGDQ

Conversation

@vkucera

@vkucera vkucera commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes C-style, redundant, wrong, and dangerous casts (found by Clang-Tidy and cpplint).

  • Remove redundant casts. (readability-redundant-casting)
  • Remove const_cast. (cppcoreguidelines-pro-type-const-cast)
  • Replace C-style casts with static_cast. (google-readability-casting, cpplint: readability/casting)
  • Replace unsafe C-style casts with dynamic_cast. (cppcoreguidelines-pro-type-cstyle-cast)
  • Replace static_cast in downcasts with dynamic_cast. (cppcoreguidelines-pro-type-static-cast-downcast)
  • Replace reinterpret_cast with static_cast or dynamic_cast. (cppcoreguidelines-pro-type-reinterpret-cast)
  • Replace two-step casting through void* with reinterpret_cast. (bugprone-casting-through-void)

@github-actions github-actions Bot added the pwgdq label Oct 21, 2026
@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 3157 warnings, 🔕 109 disabled

@github-actions github-actions Bot changed the title Fix casts [PWGDQ] Fix casts Oct 21, 2026
Fixes C-style, redundant, wrong, and dangerous casts (found by Clang-Tidy and cpplint).

- Remove redundant casts. (`readability-redundant-casting`)
- Remove `const_cast`. (`cppcoreguidelines-pro-type-const-cast`)
- Replace C-style casts with `static_cast`. (`google-readability-casting`, cpplint: `readability/casting`)
- Replace unsafe C-style casts with `dynamic_cast`. (`cppcoreguidelines-pro-type-cstyle-cast`)
- Replace `static_cast` in downcasts with `dynamic_cast`. (`cppcoreguidelines-pro-type-static-cast-downcast`)
- Replace `reinterpret_cast` with `static_cast` or `dynamic_cast`. (`cppcoreguidelines-pro-type-reinterpret-cast`)
- Replace two-step casting through `void*` with `reinterpret_cast`. (`bugprone-casting-through-void`)
@vkucera
vkucera marked this pull request as ready for review October 21, 2026 17:01
@alibuild

alibuild commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 42b4d95 at 2026-10-21 22:50:

No log files found

Full log here.

@mguilbau mguilbau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @vkucera,
Thanks a lot for this. That is a large clean-up of the DQ code. Nevertheless, I see you have move all our reinterpreted_cast to dynamic_cast. While I do understand the reasoning behind this, I recall (I was not DQ convener at that time) that this was attempted and we ended up in situation where the code was to slow and Table Maker was hitting some limits on HY.

@iarsene do you recall something of that sort? I might be mistaken

@vkucera
vkucera marked this pull request as draft October 21, 2026 23:06
@vkucera

vkucera commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @vkucera, Thanks a lot for this. That is a large clean-up of the DQ code. Nevertheless, I see you have move all our reinterpreted_cast to dynamic_cast. While I do understand the reasoning behind this, I recall (I was not DQ convener at that time) that this was attempted and we ended up in situation where the code was to slow and Table Maker was hitting some limits on HY.

@iarsene do you recall something of that sort? I might be mistaken

Hi @mguilbau , thanks for the feedback. I could use static_cast instead but then it's up to the author to verify that the cast is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants