The code is in Swift. #define is not an option.
> There’s very little reason to use macros for things like this, when an inline
> function is as efficient and safer.
IMHO function calls also help readability. My version looks like this:
private let π = M_PI
private let d2r = π / 180 // degrees to radians adjustment
private let r2d = 180 / π // radians to degrees adjustments
private func degreesToRadians(degrees: Double) -> Double {
return degrees * d2r
}
private func radiansToDegrees(radians: Double) -> Double {
return radians * r2d
}
Yeah, "π = M_PI" wasn’t really needed.
Marc
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]