Skip to content

Commit

Permalink
Note source for ivars being guaranteed to be zero-initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed May 29, 2023
1 parent 44ab9df commit bb78bca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/objc2/src/declare/ivar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ pub(crate) mod private {
//
// Additionally, the type must be safe to drop even if zero-initialized.
//
// Note that while I couldn't find a reference on whether ivars are
// zero-initialized or not, it has been true since the Objective-C version
// shipped with Mac OS X 10.0 [link] and is generally what one would expect
// coming from C. So I think it's a valid assumption to make!
// Ivars are documented to be zero-initialized in [this section of the
// Objective-C manual][obj-dynamically-created], and that has been true since
// at least [the Objective-C version shipped with Mac OS X 10.0][objc4-208].
//
// [link]: https://github.com/apple-oss-distributions/objc4/blob/objc4-208/runtime/objc-class.m#L367
// [obj-dynamically-created]: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithObjects/WorkingwithObjects.html#//apple_ref/doc/uid/TP40011210-CH4-SW7
// [objc4-208]: https://github.com/apple-oss-distributions/objc4/blob/objc4-208/runtime/objc-class.m#L367
pub unsafe trait InnerIvarType: private::Sealed + Encode {
/// The type that an `Ivar` containing this will dereference to.
///
Expand Down

0 comments on commit bb78bca

Please sign in to comment.