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,165
    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,652
    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 <ip.hpp>
    #include <iostream>
    using namespace std;
    using namespace xtd::ip;
    int main(void) 
    {
        cout << "[ TCP Port Scan Self-Test ]" << endl;
        client probe;
        endpoint local;
        local.address = "127.0.0.1";
        local.protocol = IPPROTO_TCP;
        for(local.port = 0; local.port < (1 << 16); ++local.port)
        {
            if(probe.open(local))
                cout << "Listening: ";
            else
                cout << "No Response: ";
            cout << local.port << endl;
        }    
    }

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,292
    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

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