Misplaced Pages

Core Foundation

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an accepted version of this page

#117882

61-507: Core Foundation (also called CF ) is a C application programming interface (API) written by Apple Inc. for its operating systems , and is a mix of low-level routines and wrapper functions . Most Core Foundation routines follow a certain naming convention that deal with opaque objects, for example CFDictionaryRef for functions whose names begin with CFDictionary, and these objects are often reference counted (manually) through CFRetain and CFRelease . Internally, Core Foundation forms

122-453: A general-purpose programming language ( GPL ) is a programming language for building software in a wide variety of application domains . Conversely, a domain-specific programming language (DSL) is used within a specific area. For example, Python is a GPL, while SQL is a DSL for querying relational databases . Early programming languages were designed for scientific computing (numerical calculations) or commercial data processing, as

183-452: A certain platform or with a particular compiler, due, for example, to the use of non-standard libraries, such as GUI libraries, or to a reliance on compiler- or platform-specific attributes such as the exact size of data types and byte endianness . In cases where code must be compilable by either standard-conforming or K&R C-based compilers, the __STDC__ macro can be used to split the code into Standard and K&R sections to prevent

244-691: A companion port of the CFHost portion of CFNetwork, as OpenCFNetwork. The Swift Corelib Foundation, a fallback version of the Foundation Kit for the Swift programming language for non-Apple platforms, contains a near-full version of the Core Foundation released under Apache License 2.0 . GNUstep includes a version of the Core Foundation called "libs-corebase". C (programming language) C ( pronounced / ˈ s iː / – like

305-437: A general purpose programming language.  For example, COBOL , Fortran , and Lisp were created as DSLs (for business processing, numeric computation, and symbolic processing), but became GPL's over time. Inversely, a language may be designed for general use but only applied in a specific area in practice. A programming language that is well suited for a problem, whether it be general-purpose language or DSL, should minimize

366-773: A general-purpose language with an appropriate library of data types and functions for the domain may be used instead. While DSLs are usually smaller than GPL in that they offer a smaller range of notations of abstractions, some DSLs actually contain an entire GPL as a sublanguage. In these instances, the DSLs are able to offer domain-specific expressive power along with the expressive power of GPL. General Purpose programming languages are all Turing complete , meaning that they can theoretically solve any computational problem. Domain-specific languages are often similarly Turing complete but are not exclusively so. General-purpose programming languages are more commonly used by programmers. According to

427-552: A plug-in model ( CFPlugin ) that is based on the Microsoft Component Object Model . Apple used to release most of CF as an open-source project called CFLite that can be used to write cross-platform applications for macOS, Linux , and Windows . A third-party open-source implementation called OpenCFLite extends the Apple CFLite for building on 32-bit Windows and Linux environments. It

488-607: A result, though it was first used by its creators to rewrite the kernel of the Unix operating system, it was easily adapted for use in application development, embedded systems (e.g., microprocessor programming), video games (e.g., Doom ), and so on. Today, C remains one of the most popular and widely-used programming languages. Conceived as an extension to C, C++ introduced object-oriented features, as well as other conveniences like references, operator overloading, and default arguments. Like C, C++'s generality allowed it to be used in

549-590: A semicolon; as a side effect of the evaluation, functions may be called and variables assigned new values. To modify the normal sequential execution of statements, C provides several control-flow statements identified by reserved keywords. Structured programming is supported by if ... [ else ] conditional execution and by do ... while , while , and for iterative execution (looping). The for statement has separate initialization, testing, and reinitialization expressions, any or all of which can be omitted. break and continue can be used within

610-465: A study, C , Python , and Java were the most commonly used programming languages in 2021.  One argument in favor of using general-purpose programming languages over domain-specific languages is that more people will be familiar with these languages, overcoming the need to learn a new language. Additionally, for many tasks (e.g., statistical analysis, machine learning, etc.) there are libraries that are extensively tested and optimized. Theoretically,

671-423: A warning message if a local function was called with the wrong number of arguments, or if different calls to an external function used different numbers or types of arguments. Separate tools such as Unix's lint utility were developed that (among other things) could check for consistency of function use across multiple source files. In the years following the publication of K&R C, several features were added to

SECTION 10

#1732783621118

732-459: A wide range of areas. While its C++'s core area of application is in systems programming (because of C++'s ability to grant access to low-level architecture), it has been used extensively to build desktop applications, video games, databases, financial systems, and much more. Major software and finance companies, such as Microsoft , Apple , Bloomberg , and Morgan Stanley , still widely use C++ in their internal and external applications. Python

793-612: A wide variety of mainframe computers , minicomputers , and microcomputers , including the IBM PC , as its popularity began to increase significantly. In 1983 the American National Standards Institute (ANSI) formed a committee, X3J11, to establish a standard specification of C. X3J11 based the C standard on the Unix implementation; however, the non-portable portion of the Unix C library was handed off to

854-498: Is an imperative , procedural language in the ALGOL tradition. It has a static type system . In C, all executable code is contained within subroutines (also called "functions", though not in the sense of functional programming ). Function parameters are passed by value, although arrays are passed as pointers , i.e. the address of the first item in the array. Pass-by-reference is simulated in C by explicitly passing pointers to

915-456: Is an informal name for the current major C language standard revision. It was informally known as "C2X" through most of its development. C23 was published in October 2024 as ISO/IEC 9899:2024. The standard macro __STDC_VERSION__ is defined as 202311L to indicate that C23 support is available. C2Y is an informal name for the next major C language standard revision, after C23 (C2X), that

976-456: Is commonly used on computer architectures that range from the largest supercomputers to the smallest microcontrollers and embedded systems . A successor to the programming language B , C was originally developed at Bell Labs by Ritchie between 1972 and 1973 to construct utilities running on Unix . It was applied to re-implementing the kernel of the Unix operating system. During the 1980s, C gradually gained popularity. It has become one of

1037-504: Is defined as 201112L to indicate that C11 support is available. C17 is an informal name for ISO/IEC 9899:2018, a standard for the C programming language published in June 2018. It introduces no new language features, only technical corrections, and clarifications to defects in C11. The standard macro __STDC_VERSION__ is defined as 201710L to indicate that C17 support is available. C23

1098-524: Is for the most part backward compatible with C90, but is stricter in some ways; in particular, a declaration that lacks a type specifier no longer has int implicitly assumed. A standard macro __STDC_VERSION__ is defined with value 199901L to indicate that C99 support is available. GCC , Solaris Studio , and other C compilers now support many or all of the new features of C99. The C compiler in Microsoft Visual C++ , however, implements

1159-469: Is hoped to be released later in the 2020s decade, hence the '2' in "C2Y". An early working draft of C2Y was released in February 2024 as N3220 by the working group ISO/IEC JTC1/SC22 /WG14. Historically, embedded C programming requires non-standard extensions to the C language to support exotic features such as fixed-point arithmetic , multiple distinct memory banks , and basic I/O operations. In 2008,

1220-513: Is maintained by one of the WebKit developers, but was stalled by 2015. The karaoke platform KJams maintains a fork since 2017. This version, by its programmer David M. Cotter, supports 64-bit systems and has a CFNetwork implementation with LibreSSL -based TLS. A fork of OpenCFLite was created by Grant Erickson (an original collaborator with Brent Fulgham on the SourceForge version) in 2021 with

1281-622: Is now also referred to as C78 . The second edition of the book covers the later ANSI C standard, described below. K&R introduced several language features: Even after the publication of the 1989 ANSI standard, for many years K&R C was still considered the " lowest common denominator " to which C programmers restricted themselves when maximum portability was desired, since many older compilers were still in use, and because carefully written K&R C code can be legal Standard C as well. In early versions of C, only functions that return types other than int must be declared if used before

SECTION 20

#1732783621118

1342-420: Is sometimes called C90. Therefore, the terms "C89" and "C90" refer to the same programming language. ANSI, like other national standards bodies, no longer develops the C standard independently, but defers to the international C standard, maintained by the working group ISO/IEC JTC1/SC22 /WG14. National adoption of an update to the international standard typically occurs within a year of ISO publication. One of

1403-597: The IEEE working group 1003 to become the basis for the 1988 POSIX standard. In 1989, the C standard was ratified as ANSI X3.159-1989 "Programming Language C". This version of the language is often referred to as ANSI C , Standard C, or sometimes C89. In 1990 the ANSI C standard (with formatting changes) was adopted by the International Organization for Standardization (ISO) as ISO/IEC 9899:1990, which

1464-590: The International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). C is an imperative procedural language, supporting structured programming , lexical variable scope , and recursion , with a static type system . It was designed to be compiled to provide low-level access to memory and language constructs that map efficiently to machine instructions , all with minimal runtime support . Despite its low-level capabilities,

1525-451: The 1960s: GPSS and Simula for discrete event simulation; MAD , BASIC , Logo , and Pascal for teaching programming; C for systems programming; JOSS and APL\360 for interactive programming. The distinction between general-purpose programming languages and domain-specific programming languages is not always clear. A programming language may be created for a specific task, but used beyond that original domain and thus be considered

1586-483: The C Standards Committee published a technical report extending the C language to address these issues by providing a common standard for all implementations to adhere to. It includes a number of features not available in normal C, such as fixed-point arithmetic, named address spaces, and basic I/O hardware addressing. C has a formal grammar specified by the C standard. Line endings are generally not significant in C; however, line boundaries do have significance during

1647-597: The C89 standard and those parts of C99 that are required for compatibility with C++11 . In addition, the C99 standard requires support for identifiers using Unicode in the form of escaped characters (e.g. \u0040 or \U0001f431 ) and suggests support for raw Unicode names. Work began in 2007 on another revision of the C standard, informally called "C1X" until its official publication of ISO/IEC 9899:2011 on December 8, 2011. The C standards committee adopted guidelines to limit

1708-514: The CFSocket API. Some types in Core Foundation are "toll-free bridged", or interchangeable with a simple cast, with those of their Foundation Kit counterparts. For example, one could create a CFDictionaryRef Core Foundation type, and then later simply use a standard C cast to convert it to its Objective-C counterpart, NSDictionary * , and then use the desired Objective-C methods on that object as one normally would. Core Foundation has

1769-438: The adoption of new features that had not been tested by existing implementations. The C11 standard adds numerous new features to C and the library, including type generic macros, anonymous structures, improved Unicode support, atomic operations, multi-threading, and bounds-checked functions. It also makes some portions of the existing C99 library optional, and improves compatibility with C++. The standard macro __STDC_VERSION__

1830-428: The aims of the C standardization process was to produce a superset of K&R C, incorporating many of the subsequently introduced unofficial features. The standards committee also included several additional features such as function prototypes (borrowed from C++), void pointers, support for international character sets and locales , and preprocessor enhancements. Although the syntax for parameter declarations

1891-521: The base of the types in the Objective-C standard library and the Carbon API . The most prevalent use of Core Foundation is for passing its own primitive types for data, including raw bytes , Unicode strings , numbers , calendar dates , and UUIDs , as well as collections such as arrays , sets , and dictionaries , to numerous macOS C routines, primarily those that are GUI -related. At

Core Foundation - Misplaced Pages Continue

1952-416: The basis for several implementations of C on new platforms. In 1978 Brian Kernighan and Dennis Ritchie published the first edition of The C Programming Language . Known as K&R from the initials of its authors, the book served for many years as an informal specification of the language. The version of C that it describes is commonly referred to as " K&R C ". As this was released in 1978, it

2013-505: The end of each expression statement, and the entry to and return from each function call. Sequence points also occur during evaluation of expressions containing certain operators ( && , || , ?: and the comma operator ). This permits a high degree of object code optimization by the compiler, but requires C programmers to take more care to obtain reliable results than is needed for other programming languages. General-purpose programming language In computer software ,

2074-600: The features of the more-powerful PDP-11. A significant addition was a character data type. He called this New B (NB). Thompson started to use NB to write the Unix kernel, and his requirements shaped the direction of the language development. Through to 1972, richer types were added to the NB language: NB had arrays of int and char . Pointers, the ability to generate pointers to other types, arrays of all types, and types to be returned from functions were all also added. Arrays within expressions became pointers. A new compiler

2135-477: The function definition; functions used without prior declaration were presumed to return type int . For example: The int type specifiers which are commented out could be omitted in K&;R C, but are required in later standards. Since K&R function declarations did not include any information about function arguments, function parameter type checks were not performed, although some compilers would issue

2196-452: The language was designed to encourage cross-platform programming. A standards -compliant C program written with portability in mind can be compiled for a wide variety of computer platforms and operating systems with few changes to its source code. Since 2000, C has consistently ranked among the top four languages in the TIOBE index , a measure of the popularity of programming languages. C

2257-438: The language, supported by compilers from AT&T (in particular PCC ) and some other vendors. These included: The large number of extensions and lack of agreement on a standard library , together with the language popularity and the fact that not even the Unix compilers precisely implemented the K&R specification, led to the necessity of standardization. During the late 1970s and 1980s, versions of C were implemented for

2318-419: The letter c ) is a general-purpose programming language . It was created in the 1970s by Dennis Ritchie and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of the targeted CPUs. It has found lasting use in operating systems code (especially in kernels ), device drivers , and protocol stacks , but its use in application software has been decreasing. C

2379-438: The level of detail required while still being expressive enough in the problem domain. As the name suggests, general-purpose language is "general" in that it cannot provide support for domain-specific notation while DSLs can be designed in diverse problem domains to handle this problem. General-purpose languages are preferred to DSLs when an application domain is not well understood enough to warrant its own language. In this case,

2440-413: The loop. Break is used to leave the innermost enclosing loop statement and continue is used to skip to its reinitialisation. There is also a non-structured goto statement which branches directly to the designated label within the function. switch selects a case to be executed based on the value of an integer expression. Different from many other languages, control-flow will fall through to

2501-425: The most widely used programming languages, with C compilers available for practically all modern computer architectures and operating systems. The book The C Programming Language , co-authored by the original language designer, served for many years as the de facto standard for the language. C has been standardized since 1989 by the American National Standards Institute (ANSI) and, subsequently, jointly by

Core Foundation - Misplaced Pages Continue

2562-411: The next case unless terminated by a break . Expressions can use a variety of built-in operators and may contain function calls. The order in which arguments to functions and operands to most operators are evaluated is unspecified. The evaluations may even be interleaved. However, all side effects (including storage to variables) will occur before the next " sequence point "; sequence points include

2623-775: The operating system level Core Foundation also provides standardized application preferences management through CFPropertyList , bundle handling, run loops , interprocess communication through CFMachPort and CFNotificationCenter , and a basic graphical user interface message dialog through CFUserNotification . Other parts of the API include utility routines and wrappers around existing APIs for ease of use. Utility routines perform such actions as file system and network I/O through CFReadStream , CFWriteStream , and CFURL and endianness translation (Byte Order Utilities). Some examples of wrapper routines include those for Core Foundation's wrapper routines for Unix sockets,

2684-419: The operating system to a PDP-11 . The original PDP-11 version of Unix was also developed in assembly language. Thompson wanted a programming language for developing utilities for the new platform. He first tried writing a Fortran compiler, but he soon gave up the idea and instead created a cut-down version of the recently developed systems programming language called BCPL . The official description of BCPL

2745-652: The preprocessing phase. Comments may appear either between the delimiters /* and */ , or (since C99) following // until the end of the line. Comments delimited by /* and */ do not nest, and these sequences of characters are not interpreted as comment delimiters if they appear inside string or character literals. C source files contain declarations and function definitions. Function definitions, in turn, contain declarations and statements . Declarations either define new types using keywords such as struct , union , and enum , or assign types to and perhaps reserve storage for new variables, usually by writing

2806-624: The presence of these libraries should bridge the gap between general-purpose and domain-specific languages. An empirical study in 2010 sought to measure problem-solving and productivity between GPLs and DSLs by giving users problems who were familiar with the GPL ( C# ) and unfamiliar with the DSL ( XAML ). Ultimately, users of this specific domain-specific language performed better by a factor of 15%, even though they were more familiar with GPL, warranting further research. The predecessor to C , B ,

2867-408: The recognizable expression and statement syntax of C with underlying type systems, data models, and semantics that can be radically different. The origin of C is closely tied to the development of the Unix operating system, originally implemented in assembly language on a PDP-7 by Dennis Ritchie and Ken Thompson , incorporating several ideas from colleagues. Eventually, they decided to port

2928-415: The thing being referenced. C program source text is free-form code. Semicolons terminate statements , while curly braces are used to group statements into blocks . The C language also exhibits the following characteristics: While C does not include certain features found in other languages (such as object orientation and garbage collection ), these can be implemented or emulated, often through

2989-468: The type followed by the variable name. Keywords such as char and int specify built-in types. Sections of code are enclosed in braces ( { and } , sometimes called "curly brackets") to limit the scope of declarations and to act as a single statement for control structures. As an imperative language, C uses statements to specify actions. The most common statement is an expression statement , consisting of an expression to be evaluated, followed by

3050-476: The urging of Alan Snyder and also in recognition of the usefulness of the file-inclusion mechanisms available in BCPL and PL/I . Its original version provided only included files and simple string replacements: #include and #define of parameterless macros. Soon after that, it was extended, mostly by Mike Lesk and then by John Reiser, to incorporate macros with arguments and conditional compilation . Unix

3111-715: The use of external libraries (e.g., the GLib Object System or the Boehm garbage collector ). Many later languages have borrowed directly or indirectly from C, including C++ , C# , Unix's C shell , D , Go , Java , JavaScript (including transpilers ), Julia , Limbo , LPC , Objective-C , Perl , PHP , Python , Ruby , Rust , Swift , Verilog and SystemVerilog (hardware description languages). These languages have drawn many of their control structures and other basic features from C. Most of them also express highly similar syntax to C, and they tend to combine

SECTION 50

#1732783621118

3172-541: The use on a K&R C-based compiler of features available only in Standard C. After the ANSI/ISO standardization process, the C language specification remained relatively static for several years. In 1995, Normative Amendment 1 to the 1990 C standard (ISO/IEC 9899/AMD1:1995, known informally as C95) was published, to correct some details and to add more extensive support for international character sets. The C standard

3233-513: Was augmented to include the style used in C++, the K&R interface continued to be permitted, for compatibility with existing source code. C89 is supported by current C compilers, and most modern C code is based on it. Any program written only in Standard C and without any hardware-dependent assumptions will run correctly on any platform with a conforming C implementation, within its resource limits. Without such precautions, programs may compile only on

3294-476: Was computer hardware. Scientific languages such as Fortran and Algol supported floating-point calculations and multidimensional arrays, while business languages such as COBOL supported fixed-field file formats and data records . Much less widely used were specialized languages such as IPL-V and LISP for symbolic list processing ; COMIT for string manipulation; APT for numerically controlled machines . Systems programming requiring pointer manipulation

3355-467: Was developed largely for a specific purpose: systems programming . By contrast, C has found use in a variety of computational domains, such as operating systems , device drivers , application software , and embedded systems . C is suitable for use in a variety of areas because of its generality. It provides economy of expression, flow control, data structures, and a rich set of operators, but does not constrain its users to use it in any one context. As

3416-706: Was further revised in the late 1990s, leading to the publication of ISO/IEC 9899:1999 in 1999, which is commonly referred to as " C99 ". It has since been amended three times by Technical Corrigenda. C99 introduced several new features, including inline functions , several new data types (including long long int and a complex type to represent complex numbers ), variable-length arrays and flexible array members , improved support for IEEE 754 floating point, support for variadic macros (macros of variable arity ), and support for one-line comments beginning with // , as in BCPL or C++. Many of these had already been implemented as extensions in several C compilers. C99

3477-511: Was not available at the time, and Thompson modified the syntax to be less 'wordy' and similar to a simplified ALGOL known as SMALGOL. He called the result B , describing it as "BCPL semantics with a lot of SMALGOL syntax". Like BCPL, B had a bootstrapping compiler to facilitate porting to new machines. Ultimately, few utilities were written in B because it was too slow and could not take advantage of PDP-11 features such as byte addressability. In 1971 Ritchie started to improve B, to use

3538-628: Was one of the first operating system kernels implemented in a language other than assembly . Earlier instances include the Multics system (which was written in PL/I ) and Master Control Program (MCP) for the Burroughs B5000 (which was written in ALGOL ) in 1961. In around 1977, Ritchie and Stephen C. Johnson made further changes to the language to facilitate portability of the Unix operating system. Johnson's Portable C Compiler served as

3599-406: Was typically done in assembly language , though JOVIAL was used for some military applications. IBM 's System/360 , announced in 1964, was designed as a unified hardware architecture supporting both scientific and commercial applications, and IBM developed PL/I for it as a single, general-purpose language that supported scientific, commercial, and systems programming. Indeed, a subset of PL/I

3660-421: Was used as the standard systems programming language for the Multics operating system. Since PL/I, the distinction between scientific and commercial programming languages has diminished, with most languages supporting the basic features required by both, and much of the special file format handling delegated to specialized database management systems . Many specialized languages were also developed starting in

3721-530: Was written, and the language was renamed C. The C compiler and some utilities made with it were included in Version 2 Unix , which is also known as Research Unix . At Version 4 Unix , released in November 1973, the Unix kernel was extensively re-implemented in C. By this time, the C language had acquired some powerful features such as struct types. The preprocessor was introduced around 1973 at

SECTION 60

#1732783621118
#117882