简体   繁体   中英

How to use C++11's minimal gc support

As I know, C++11's GC support just provide GC interface, and there's no implementation which support this GC. But anyway, If there were an implementation which support C++11's GC, How could I use GC?

edit: and please explain me C++11's GC support function(of course, If implementation supported C++11's GC), declare_reachabe() undeclare_reachabe() declare_no_pointers() undeclare_no_pointers() get_pointer_safety()

The basic idea of GC is that you simply ignore it (and ignore deleting objects when you're done using them).

There are a few places/times you need to declare something as reachable (eg, if you "swizzle" a pointer or temporarily store it in a file). Those are sufficiently rare that most code never has a reason to bother though.

Other than that, the basic idea is that you simply always have memory available, even if you manage it sloppily. You shouldn't normally need to do anything to use it other than do whatever the compiler requires to turn it on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM