Skip to main content

Compatibility and Strandered library of C++

To give compiler vendors greater freedom, the C++ standards committee decided not to dictate the implementation of name manglingexception handling, and other implementation-specific features. The downside of this decision is that object code produced by different compilers is expected to be incompatible. There were, however, attempts to standardize compilers for particular machines or operating systems (for example C++ ABI),[53] though they seem to be largely abandoned now.

With CEdit

For more details on this topic, see Compatibility of C and C++.
C++ is often considered to be a superset of C, but this is not strictly true.[54]Most C code can easily be made to compile correctly in C++, but there are a few differences that cause some valid C code to be invalid or behave differently in C++. For example, C allows implicit conversion from void* to other pointer types, but C++ does not (for type safety reasons). Also, C++ defines many new keywords, such as new and class, which may be used as identifiers (for example, variable names) in a C program.
Some incompatibilities have been removed by the 1999 revision of the C standard (C99), which now supports C++ features such as line comments (//), and declarations mixed with code. On the other hand, C99 introduced a number of new features that C++ did not support, were incompatible or redundant in C++, such as variable-length arrays, native complex-number types (however, the std::complex class in the C++ standard library provides similar functionality, although not code compatible), designated initializers, compound literals, and the restrict keyword.[55] Some of the C99-introduced features were included in the subsequent version of the C++ standard, C++11 (out of those which were not redundant).[56][57][58] However, the C++11 standard introduces new incompatibilities, such as disallowing assignment of a string literal to a character pointer, which remains valid C.
To intermix C and C++ code, any function declaration or definition that is to be called from/used both in C and C++ must be declared with C linkage by placing it within an extern "C" {/*...*/} block. Such a function may not rely on features depending on name mangling (i.e., function overloading).

Standard libraryEdit

Main article: C++ Standard Library
The C++ standard consists of two parts: the core language and the standard library. C++ programmers expect the latter on every major implementation of C++; it includes vectors, lists, maps, algorithms (find, for_each, binary_search, random_shuffle, etc.), sets, queues, stacks, arrays, tuples, input/output facilities (iostream, for reading from and writing to the console and files), smart pointersfor automatic memory management, regular expression support, multi-threading library, atomics support (allowing a variable to be read or written to by at most one thread at a time without any external synchronisation), time utilities (measurement, getting current time, etc.), a system for converting error reporting that doesn't use C++ exceptions into C++ exceptions, a random number generator and a slightly modified version of the C standard library (to make it comply with the C++ type system).
A large part of the C++ library is based on the Standard Template Library (STL). Useful tools provided by the STL include containers as the collections of objects (such as vectors and lists), iterators that provide array-like access to containers, and algorithms that perform operations such as searching and sorting.
Furthermore, (multi)maps (associative arrays) and (multi)sets are provided, all of which export compatible interfaces. Therefore, using templates it is possible to write generic algorithms that work with any container or on any sequence defined by iterators. As in C, the features of the library are accessed by using the #include directive to include a standard header. C++ provides 105 standard headers, of which 27 are deprecated.
The standard incorporates the STL that was originally designed by Alexander Stepanov, who experimented with generic algorithms and containers for many years. When he started with C++, he finally found a language where it was possible to create generic algorithms (e.g., STL sort) that perform even better than, for example, the C standard library qsort, thanks to C++ features like using inlining and compile-time binding instead of function pointers. The standard does not refer to it as "STL", as it is merely a part of the standard library, but the term is still widely used to distinguish it from the rest of the standard library (input/output streams, internationalization, diagnostics, the C library subset, etc.).[52]
Most C++ compilers, and all major ones, provide a standards conforming implementation of the C++ standard library.

source wikipedia

Comments

Popular posts from this blog

QBasic and its history

QBasic Not to be confused with  Quick Basic . QBasic Paradigm Procedural Developer Microsoft First appeared 1991 ; 25 years ago OS MS-DOS ,  Windows 95 ,  Windows 98 ,  Windows Me ,  PC DOS ,  OS/2 , eComStation License Part of the operating system (a variety of  closed-source  licenses) Website www .microsoft .com Influenced by QuickBASIC ,  GW-BASIC Influenced QB64 ,  Small Basic QBasic  ( Microsoft  Quick Beginners All purpose Symbolic Instruction Code ) is an  IDE  and  interpreter  for a variety of the  BASIC programming language  which is based on  QuickBASIC . Code entered into the IDE is compiled to an intermediate representation , and this  IR  is immediately interpreted on demand within the IDE. [1]  It can run under nearly all versions of  DOS  and  Windows , or through  DOSBox / DOSEMU , on  Linux  and...

BIOS

BIOS From Wikipedia, the free encyclopedia This article is about the BIOS as found in IBM PC compatibles. For similar programs on non-PC systems, see  booting . The  BIOS  ( / ˈ b aɪ . ɒ s / , an acronym for  Basic Input/Output System  and also known as the  System BIOS ,  ROM BIOS  or  PC BIOS ) is a type of  firmware  used to perform hardware initialization during the  booting  process (power-on startup) on  IBM PC compatible  computers, and to provide runtime services for operating systems and programs. [1]  The BIOS firmware is built into  personal computers  (PCs), and it is the first software they run when powered on. The name itself originates from the Basic Input/Output System used in the CP/M  operating system in 1975. [2] [3]  Originally  proprietary  to the IBM PC, the BIOS has been  reverse engineered  by companies looking to create compatible ...

10 ways to earn money from website

If you dont know how to make a website click here for free guidelines When you are running your own site and finally start to see some serious traffic, you’ll probably want to earn some money from it. In this article we’ll look at 10 of the most popular ways to make money from your site. In each section I’ll list the big players in that specific field, but there are many more opportunities available–Google is your friend. You’ll find that you can mix and match many of these methods. Just be careful that you don’t overcrowd your site with ads. And of course you’ll need to test to find out what works best for your site. Let’s get started. 1. Cost-per-Click Ads Displaying banners based on a cost-per-click basis is the easiest way to make money with a site. Usually it’s just a matter of creating the ad banners and placing them in visible places and within the guidelines. You then get paid for each click on the ads. CPC ads come in many forms, from the traditional 468×60 ba...