Skip to content

Remove .NET-specific concepts from C++ DisposableBase class#91

Open
konard wants to merge 4 commits intomainfrom
issue-61-09315838
Open

Remove .NET-specific concepts from C++ DisposableBase class#91
konard wants to merge 4 commits intomainfrom
issue-61-09315838

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

This PR removes superfluous .NET-specific concepts from the C++ DisposableBase class that were inappropriate for C++ manual memory management:

  • Removed GC.SuppressFinalize(this) call - C++ doesn't have garbage collection
  • Removed static ConcurrentStack<WeakReference<DisposableBase>> tracking - This pattern is specific to .NET's garbage collection model
  • Replaced Interlocked.CompareExchange with std::atomic operations - Used proper C++ atomic operations
  • Removed OnProcessExit method - The .NET-specific process exit handling is not needed in C++
  • Fixed method call syntax - Changed property-style calls to function calls with parentheses
  • Added necessary C++ headers - atomic, string, typeinfo, cstdint

Test plan

  • Created test compilation file to verify syntax correctness
  • Verified the code compiles successfully with g++ -std=c++17
  • Tested runtime behavior to ensure disposal mechanism works correctly

The changes eliminate the "superfluous" .NET concepts mentioned in issue #61, making the C++ implementation more idiomatic and appropriate for manual memory management.

🤖 Generated with Claude Code


Resolves #61

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

Issue: #61
@konard konard self-assigned this Sep 13, 2025
- Remove GC.SuppressFinalize call (C++ doesn't have garbage collection)
- Remove static readonly ConcurrentStack for WeakReference tracking
- Replace Interlocked.CompareExchange with std::atomic operations
- Remove OnProcessExit method with .NET-specific features
- Fix method call syntax to use parentheses for C++ function calls
- Add necessary C++ headers (atomic, string, typeinfo, cstdint)

These changes eliminate superfluous .NET concepts that don't apply to C++
manual memory management, making the code more appropriate for C++.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Remove this guy from cpp classes Remove .NET-specific concepts from C++ DisposableBase class Sep 13, 2025
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>'
@konard konard marked this pull request as ready for review September 13, 2025 16:15
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.

Remove this guy from cpp classes

1 participant