Garbage Collector

This is a discussion on Garbage Collector within the C++ Programming forums, part of the General Programming Boards category; Why is it not possible to build a garbage collector for C++ when pointers are used?...

  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
    4,370
    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,308
    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, 08:20 AM
  2. Garbage Collector, Managed Heap etc.
    By mynickmynick in forum C Programming
    Replies: 2
    Last Post: 08-07-2008, 01:42 PM
  3. Garbage Collection
    By Orborde in forum C++ Programming
    Replies: 4
    Last Post: 05-11-2005, 12:18 AM
  4. Pointers and garbage collectors
    By Morglum in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2002, 03:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21