C vs Swift: Reprise

I revisit a post by David Steuber, which benchmarked C and Swift generating a 2880x2880 pixel Mandelbrot with 4000 iterations per pixel. C killed Swift.

Read On →

Perspective: Relative computing power

A brief exploration how far computing has come by comparing a Cray 1 supercomputer with an iPhone 6

Read On →

lldb: VI mode and tab-completion

lldb uses libedit, which is a BSD licensed alternative to GNU readline. A feature of libedit is the ability to configure per-application settings for command-line bindings via ~/.editrc. Detailed documentation for this configuration file can be found using man editrc or via online documentation, such as developer.apple.com. As I prefer VI bindings, I initially configured my .editrc as follows, to replace the default emacs bindings: lldb:bind -v Unfortunately, when I re-ran lldb, tab-completion was not functioning. Read On →

llvm / Clang hacking: Part 3

Part 3 in my N-part series on my exploration of hacking on llvm and Clang (c-language) tool chain. Prerequisites This post assumes you’ve successfully completed Part 1 and Part 2 of the series. I’m also going to assume if you’re interested in hacking on Clang, you have an understanding of compilation and are familiar with terms such as lexing, parsing, syntactic analysis, semantic analysis and code generation. If not, then you need to purchase a copy of Compilers: Principals, Techniques and Tools, also known as the Dragon Book and read through it. Read On →

llvm / Clang hacking: Part 2

Part 2 in my N-part series on my exploration of hacking on llvm and Clang (c-language) tool chain. Prerequisites This post assumes you’ve successfully completed Part 1 of the series. Debugging By default, Clang presents a gcc-compatible command-line interface. In most circumstances, this allows Clang to be a drop-in replacement for gcc for rapid testing and easier adoption. When using the gcc interface, Clang spawns a new job to handle the compilation, which prevents debugging the various stages of the compilation process. Read On →

llvm / Clang hacking: Part 1

Part 1 in my N-part series on my exploration of hacking on llvm and Clang (c-language) tool chain. I am running OS X 10.7, however I will try to highlight the steps where you should consider substituting for your platform. Getting Started Follow these steps, with the following exceptions if you prefer git (it is a lot faster); I am using the official llvm mirror on llvm.org. Step 2, substitute the svn command for $ git clone http://llvm.org/git/llvm.git Step 3, substitute the svn command for $ git clone http://llvm.org/git/clang.git Step 4, substitute the svn command for $ git clone http://llvm.org/git/compiler-rt.git Step 5, I am using CMake, so instead of ../llvm/configure $ cmake -G "Unix Makefiles" ../llvm $ make Creating Xcode project for Clang You could run $ mkdir llvm $ cd llvm $ cmake -G Xcode ../llvm to create an Xcode project for the entire llvm/Clang toolchain, however it ends up being thousands of source files and 223 targets! Read On →

Objective-C: ternary operator

The ternary operator, also known as a conditional expression is a C construct. What follows is an example used for conditional assignment: result = condition_expression ? true_expression : false_expression; If condition_expression evaluates to true, result will be assigned the true_expression; otherwise, result will be assigned the false_expression. A GNU extension to the ternary operator, also available in Objective-C, is the ability to omit the true_expression as follows: result = first_expression ?: second_expression; result will be assigned the value of first_expression if it evaluates to true or second_expression if first_expression evaluates to false. Read On →

Associative References in Objective-C

this is a description

Read On →

Constant Confusion

The const keyword in C can be confusing, so I wanted to put down my thoughts for my own benefit and for those looking for some clarity. In summary, I’m going to advocate you place const to the right, and read the declaration from right to left. What is const? const is a hint to the C compiler and programmer that a specific declaration or element of a declaration is immutable. Read On →

Transferring Preview app signatures in Lion

Lion introduced a great new feature that allows you to capture your signature via an attached camera and store it in an encrypted form for later use. Therein lies the problem; you must have an attached camera. I have a Mac Pro, and wanted to use the signatures I captured on my Macbook Pro. Following these steps, you can transfer the encrypted signatures over. On your machine endowed with the power of sight: Go ahead and capture the signatures in Preview. Read On →