Re: Objective-C: What is the current preferred method of declaring constants without a .pch?


Fritz Anderson
 

I want faster builds. We all want faster builds. The question is whether precompiling text-substituted inclusions is the best we can do with a modern development system.

The answer was yes when lexical insertion was the only way to impart context to a C-family source file. The answer should be no because the effect of a chain of #includes depends on the order they're done. If a.h says

#ifndef FOO
    #undef FOO
    #define FOO bar
#end

and b.h says

#ifndef FOO
    #undef FOO
    #define FOO baz
#end

Then it's really important (and impossible to document and surely intractable to debug) the order in which they are #included. Modules are precompiled and versioned against the environment in which that happened. Macro conflicts within a module are "ill-formed" and across modules they're local.

Caveat that I'm drawing the details from memory and a cursory review of http://releases.llvm.org/3.5.0/tools/clang/docs/Modules.html . Further discussion should address the LLVM release note, not my memory.

    — F

On Oct 19, 2017, at 6:04 PM, Steve Mills <sjmills@...> wrote:

Why wouldn’t you want faster builds?

Join cocoa@apple-dev.groups.io to automatically receive all group messages.