Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No ARC support #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

No ARC support #10

wants to merge 4 commits into from

Conversation

DevNulPavel
Copy link
Contributor

Autorelease method included for allocated objects

@Peach1
Copy link

Peach1 commented Jul 4, 2018

This pull request would make projects using mtlpp not run on 10.12 and later.
You can switch to ARC in your codebase and still support 10.6 and later + iOS 4 and later

Any Objective C code that manually calls autorelease uses Objective C Garbage Collection which has been deprecated on Mac since 10.8

ARC is the new way to manage memory since 10.6 and iOS4
Full details are here:
https://developer.apple.com/library/archive/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

  • You cannot explicitly invoke dealloc, or implement or invoke retain, release, retainCount, or autorelease.

  • You may implement a dealloc method if you need to manage resources other than releasing instance variables.

    • Custom dealloc methods in ARC do not require a call to [super dealloc] (it actually results in a compiler error). The chaining to super is automated and enforced by the compiler.
  • There is no casual casting between id and void *.
    (This is why mtlpp uses (__bridge void*) instead of (void*) )


Transitioning existing code bases to ARC is often easy

In Xcode's build settings, enable
Objective-C Automatic Reference Counting
And you can fix most if not all compile errors
by removing dealloc, retain, release, retainCount, and autorelease calls from code

This pull request makes the code use autorelease, which depends on Objective-C garbage collection. Objective-C with garbage collection does not compile or run on current versions of Apple's operating systems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants