News for hackers. Stuff that matters.
Re:C++ the Good Parts (2014) by ncmncm on Thursday October 01, 2020 @12:24PM (#24652808)
Not the same, and overwhelmingly less useful.
Re:C++ the Good Parts (2014) by setpatchaddress on Thursday October 01, 2020 @01:23PM (#24653658)
dealloc is pretty much the same thing, and it can be used in the same way. It's not "useful" in the C++ RAII sense because:

- the standard library design -- every object is refcounted and any code that references the object can add it to an autorelease pool, so you can't safely predict when dealloc will be invoked

- Objective C doesn't support stack-based objects

Re:C++ the Good Parts (2014) by richardwhiuk on Thursday October 01, 2020 @03:23PM (#24655160)
You can do stuff:

  @autoreleasepool {
    RaiObj* obj = [RaiObj new];
    [obj autorelease];

    //... stuff
  }
will de-allocate at the end of the block if nothing else hold onto it, but it's obviously less neat.