5 ms·
Mac OS X v10.6 provides support for block objects in C, C++, and Objective-C. Huh? Isn't this a feature of a compiler, not an OS?
by andreyf 17y ago
Mac OS X v10.6 provides support for block objects in C, C++, and Objective-C.
Huh? Isn't this a feature of a compiler, not an OS?
- 9oliYQjP 17y agoI'm not sure why you got down voted to 0 for asking a legitimate question. The block objects are part of Grand Central Dispatch. A programmer tags an isolated unit of work as a block. The OS then takes these blocks and schedules them into execution queues. While the compiler adds support for defining the blocks themselves, OS X 10.6 provides purpose to these blocks. Just like you can have a VM which supports threads on an OS that itself is not multi-threaded, the feature would be pretty useless if only the compiler were updated as it has been for 10.6
- masklinn 17y agoIt also needs the instantiation support at the VM/runtime level, which is separate from the services the OS itself provides. So blocks need to be supported at the compiler level, in the Objective-C runtime and in OS-wide processes (which would be Grand Central itself).
- wmf 17y agoOS X includes its own compilers.
- pohl 17y agoThis is one reason why I like the old NeXT term "system software" in favor of "OS". (The former is all inclusive.) Blocks are a language feature, and do need compiler support. The version of the compiler that you need to use them in GCD comes with v10.6 system software.
- antonovka 17y agoIt involves compiler and runtime changes, although they have been backported to the iPhone and 10.5: http://code.google.com/p/plblocks/ http://code.google.com/p/plblocks/