user102008 user102008 - 6 months ago 23
Objective-C Question

In Objective-C ARC, what are "BPTRs declared within extern "BCPL" blocks"?

In the Clang documentation for ARC, it says:


ARC applies to Objective-C pointer types, block pointer types, and
[beginning Apple 8.0, LLVM 3.8] BPTRs declared within extern "BCPL"
blocks.


What are these "BPTRs declared within extern "BCPL" blocks"?

Answer

It's a small in-joke.

C++ has the ability to mark identifiers with C linkage, which usually just means no name mangling of functions with the same name but different parameter signature, since C, until recently, had no concept of overloading1.

The way you specify that linkage is by surrounding the identifiers with:

extern "C" {
    whatever ...
}

Now, BCPL is a language that pre-dates even C (it actually forms part of the C lineage) and its "linkage" (for want of a better word) was simply a table of addresses known as the global vector.

The author of that document you reference was simply being humorous, CLang doesn't actually provide extern "BCPL" things. You'll also notice that the current version of LLVM is 3.2 with 3.3 not due until June this year. Another indication that the author was having us on, with the LLVM 3.8 comment.

Since the intent of that sentence was simply to show how annotations (within []) work, the rest of the text was largely irrelevant.


1 With the introduction of type-generic expressions in C11, it now it has overloading of a sort, though done at compile time rather than run time.

Comments