Back to all reviewers

Consistent code organization

pytorch/pytorch
Based on 3 comments
Other

Follow consistent code organization patterns: 1. Place static definitions in .cpp files rather than headers to prevent duplicate definitions when included in multiple compilation units:

Code Style Other

Reviewer Prompt

Follow consistent code organization patterns:

  1. Place static definitions in .cpp files rather than headers to prevent duplicate definitions when included in multiple compilation units: ```cpp // Avoid in header (.hpp): static HeartbeatMonitor* get() { static HeartbeatMonitor instance; return &instance; }

// Prefer in implementation (.cpp): HeartbeatMonitor* HeartbeatMonitor::get() { static HeartbeatMonitor instance; return &instance; }


2. Explicitly define class semantics using appropriate macros and default specifications:
```cpp
class BiasHandler {
  C10_DISABLE_COPY_AND_ASSIGN(BiasHandler);
  
  BiasHandler(BiasHandler&&) = default;
  BiasHandler& operator=(BiasHandler&&) = default;
  
  // Class implementation...
};
  1. Maintain consistent implementation patterns across related components (e.g., use class-based or function-based implementations consistently for similar functionality). When extending existing code, follow the established patterns from the CPU implementation or related components.
3
Comments Analyzed
Other
Primary Language
Code Style
Category

Source Discussions