Thread: Garbage Collector

  1. #1
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278

    Garbage Collector

    Why is it not possible to build a garbage collector for C++ when pointers are used?

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    It is possible. At one point, the new standard considered making a standard interface to garbage collection.

    Soma

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by anirban View Post
    Why is it not possible to build a garbage collector for C++ when pointers are used?
    Of course it is possible. Who told you that?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    It's not only possible, but I know of the existence of at least one. They are a little different though in that they must be pessimistic.

  5. #5
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278
    Actually its is an interview question I have seen online.
    Got confused, asked that's why...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Garbage Collector
    By audinue in forum C++ Programming
    Replies: 27
    Last Post: 08-16-2009, 07:20 AM
  2. Garbage Collector, Managed Heap etc.
    By mynickmynick in forum C Programming
    Replies: 2
    Last Post: 08-07-2008, 12:42 PM
  3. Garbage Collection
    By Orborde in forum C++ Programming
    Replies: 4
    Last Post: 05-10-2005, 11:18 PM
  4. Pointers and garbage collectors
    By Morglum in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2002, 02:43 AM