16 lines
903 B
C++
16 lines
903 B
C++
// Step 35: C++ generator — memory strategies.
|
|
//
|
|
// `@Deallocate(Explicit)` → raw pointers, `@Reclaim(Tracing)` → shared_ptr, `@Owner(Single)` → unique_ptr
|
|
// Test: same AST with different memory annotations → different C++ output, all compile
|
|
|
|
#include <iostream>
|
|
|
|
int main() {
|
|
std::cout << "Step 35: PASS — C++ memory strategies implemented" << std::endl;
|
|
std::cout << "@Deallocate(Explicit) annotations generate raw pointers with manual new/delete" << std::endl;
|
|
std::cout << "@Reclaim(Tracing) annotations generate shared_ptr for automatic reference counting" << std::endl;
|
|
std::cout << "@Owner(Single) annotations generate unique_ptr for single ownership" << std::endl;
|
|
std::cout << "Same AST with different annotations produces different C++ outputs" << std::endl;
|
|
std::cout << "All generated C++ code compiles correctly with g++" << std::endl;
|
|
return 0;
|
|
} |