Use namespace instead of class#2428
Conversation
* ACE/apps/JAWS/server/HTTP_Server.cpp:
WalkthroughThe change refactors the definition of several constants in Changes
Sequence Diagram(s)sequenceDiagram
participant Code
participant JAWS Namespace
Code->>JAWS Namespace: Access JAWS_POOL, JAWS_PER_REQUEST, JAWS_SYNCH, JAWS_ASYNCH
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ACE/apps/JAWS/server/HTTP_Server.cpp (1)
16-23: Preferinline constexpr(or plainconstexpr) overstatic constexprat namespace scopeAt namespace scope
staticgives each translation unit its own copy of the variable (internal linkage).
The previous class-static constants had external linkage, so any other translation unit could reference a single definition.
If these constants are (or will be) accessed outside this.cpp, the current change silently alters the linkage and can lead to ODR bloat or link errors.A minimal, C++17-friendly tweak:
-namespace JAWS -{ - static constexpr size_t JAWS_POOL = 0; - static constexpr size_t JAWS_PER_REQUEST = 1; - - static constexpr size_t JAWS_SYNCH = 0; - static constexpr size_t JAWS_ASYNCH = 2; -} +namespace JAWS +{ + inline constexpr std::size_t JAWS_POOL = 0; + inline constexpr std::size_t JAWS_PER_REQUEST = 1; + + inline constexpr std::size_t JAWS_SYNCH = 0; + inline constexpr std::size_t JAWS_ASYNCH = 2; +}•
inlinepreserves the single-definition semantics across TUs
•std::size_tcomes from<cstddef>and is the canonical typeIf the constants are truly implementation-only for this file, dropping
staticentirely (constexpr std::size_t …) keeps the linkage internal while avoiding the dated specifier.Please double-check that no header or other
.cpprelies on these symbols; if they do, switching toinline(or moving the block to a header) is required.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ACE/apps/JAWS/server/HTTP_Server.cpp(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
Summary by CodeRabbit