7

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"?

user102008
  • 30,736
  • 10
  • 83
  • 104

2 Answers2

8

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.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
2

This line is obviously taken randomly from an unknown context just to demonstrate revision markers like [beginning Apple 8.0, LLVM 3.8], and BPTRs and BCPL do not mean anything specific. Generally, BPTR means something like byte pointer.

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
  • 2
    If I can offer a correction, BPTR is a type declared in AmigaOS, as AmigaDOS was a port of Tripos, written in BCPL. AmigaOS used APTR as an "address pointer", and BPTR as "BCPL pointer." BPTRs are NOT byte pointers, since BCPL itself is a word-addressed virtual machine, not a byte-addressed machine like C. Hence to translate BPTRs into a byte address, you would evaluate ap = (APTR)(((WORD)bp)*sizeof(WORD)). Most programmers would just make some hardware assumptions and write ap = (APTR)(bp << 2) or the like. – Samuel A. Falvo II Mar 29 '14 at 04:18
  • 1
    Hi Samuel, thanks for your comment - I was not aware of this. Great info! – Reinhard Männer Mar 30 '14 at 12:49