Skip to main content
17 events
when toggle format what by license comment
Nov 13, 2021 at 23:26 comment added Captain Hatteras @upkajdt No, you are correct! Sorry that it seemed that I was misinterpreting your comment. I was simply noting that, while C++ doesn't have much use for my class gcpointer, I made this not for any specific use, but just for a personal challenge.
Nov 13, 2021 at 22:15 comment added jdt I'm sorry if my comment seemed concending, it was not the intention. We all learn with experimenting, have fun!
Nov 13, 2021 at 21:00 history tweeted twitter.com/StackCodeReview/status/1459627135631511553
Nov 13, 2021 at 19:32 history became hot network question
Nov 13, 2021 at 19:30 vote accept Captain Hatteras
Nov 13, 2021 at 19:00 comment added Captain Hatteras @CrisLunengo the point is to get rid of the need for differentiating between shared and weak. Like said, I made this for the fun.
Nov 13, 2021 at 18:58 comment added Captain Hatteras @upkajdt I made this just for the fun and experience.
Nov 13, 2021 at 16:16 comment added Cris Luengo Could you show a practical use case of these ownership loops? I don’t understand why A needs to own B and B needs to own A. I think any program like this can be rewritten in a more logical and simple way where one of the two doesn’t own the other. In modern C++ we have 3 “types of pointer”: unique, shared, naked. The first two imply ownership, the latter implies non ownership. People are afraid of naked pointers, but I think they should be used when referring to something we don’t own.
Nov 13, 2021 at 12:33 comment added jdt @Pepijn Kramer, I don't think C++ will ever force you to use a garbage collector, but I suppose it could be useful in some instances. Not that I can really think of any =)
Nov 13, 2021 at 12:24 answer added G. Sliepen timeline score: 6
Nov 13, 2021 at 11:49 answer added Toby Speight timeline score: 7
Nov 13, 2021 at 11:26 history edited G. Sliepen
edited tags
Nov 13, 2021 at 7:23 comment added Pepijn Kramer I wouldn't add garbage collection to C++. Because you take away one of its main strengths : explicit life time managment and predictability. If you need garbage collection there are other more suited languages
Nov 12, 2021 at 23:14 comment added Captain Hatteras @Deduplicator I am not sure what you mean. Have you looked at my code? In the destructor for garbage_collector, I set a flag which basically causes the destructor of the gcpointers to not touch the memory that they point to. Please take a look.
Nov 12, 2021 at 21:57 comment added Deduplicator What happens if a loop is unreachable? Because whichever you destroy first, the rest may stumble over.
S Nov 12, 2021 at 20:47 review First questions
Nov 13, 2021 at 10:31
S Nov 12, 2021 at 20:47 history asked Captain Hatteras CC BY-SA 4.0