Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

This PR implements the LinksPlatform decision to use #pragma once instead of traditional header guards in all C++ headers, as discussed in this decision.

Changes Made

  • cpp/Platform.Ranges/Range.h: Added #pragma once at the top
  • cpp/Platform.Ranges/Range[T].h: Added #pragma once at the top
  • cpp/Platform.Ranges/EnsureExtensions.h: Added #pragma once at the top
  • cpp/Platform.Ranges/RangeExtensions.h: Added #pragma once at the top
  • cpp/Platform.Ranges.Tests/pch.h: Replaced traditional #ifndef/#define/#endif guards with #pragma once

Benefits

  • Less code: Reduces boilerplate compared to traditional include guards
  • Easier maintenance: No need to manage unique guard names across headers
  • Modern approach: Follows current C++ best practices adopted by the LinksPlatform organization
  • Consistency: Aligns with the existing Platform.Ranges.h which already uses #pragma once

Compatibility

All modern C++ compilers support #pragma once. The trade-off of dropping support for very old compilers was accepted per the organizational decision.

Test plan

  • All header files now have #pragma once at the top
  • Existing #pragma once in Platform.Ranges.h remains unchanged
  • Traditional guards in pch.h successfully replaced
  • Headers maintain proper C++ syntax structure
  • Changes follow the established project decision

Closes #43

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #43
@konard konard self-assigned this Sep 13, 2025
This change implements the LinksPlatform decision to use #pragma once
instead of traditional header guards in all C++ headers. The following
files were updated:

- cpp/Platform.Ranges/Range.h: Added #pragma once
- cpp/Platform.Ranges/Range[T].h: Added #pragma once
- cpp/Platform.Ranges/EnsureExtensions.h: Added #pragma once
- cpp/Platform.Ranges/RangeExtensions.h: Added #pragma once
- cpp/Platform.Ranges.Tests/pch.h: Replaced traditional guards with #pragma once

This provides cleaner, more maintainable header protection across the codebase
while ensuring compatibility with modern C++ compilers.

Fixes #43

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add #pragma once or include guards in headers Add #pragma once to all header files Sep 13, 2025
@konard konard marked this pull request as ready for review September 13, 2025 18:10
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>'
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.

Add #pragma once or include guards in headers

2 participants