22 lines
651 B
Plaintext
22 lines
651 B
Plaintext
Conditional compilation is generally recognized as a bad practice that is occasionally necessary when dealing with platform-specific code. As much as possible, code should be refactored to minimize or eliminate conditionally-compiled, platform-specific code because even when necessary and well-intentioned, such code segments can leave your codebase in a hopeless tangle.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
#if os(OSX) // Noncompliant
|
|
let a = 2
|
|
#else
|
|
let a = 3
|
|
#endif
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|