The ansi/iso c++ Standard



Download 12.87 Kb.
Date28.01.2017
Size12.87 Kb.
#9292

Unix System Programming 10CS62

The ANSI/ISO C++ Standard

These compilers support C++ classes, derived classes, virtual functions, operator overloading. Furthermore, they should also support template classes, template functions, exception handling and the iostream library classes.



Differences between ANSI C and C++

ANSI C

C++

Uses K&R C default function declaration for any functions that are referred before their declaration in the program.


Requires that all functions must be declared / defined before they can be referenced.


int foo(); ANSI C treats this as old C function declaration & interprets it as declared in following manner. int foo(........); meaning that foo may be called with any number of arguments.


int foo(); C++ treats this as int foo(void); Meaning that foo may not accept any arguments


Does not employ type_safe linkage technique and does not catch user errors.


Encrypts external function names for type_safe linkage. Thus reports any user errors.



The POSIX standards
POSIX or “Portable Operating System Interface” is the name of a family of related standards specified by the IEEE to define the application-programming interface (API), along with shell and utilities interface for the software compatible with variants of the UNIX operating system.

  • Because many versions of UNIX exist today and each of them provides its own set of API functions, it is difficult for system developers to create applications that can be easily ported to different versions of UNIX.

  • Some of the subgroups of POSIX are POSIX.1, POSIX.1b & POSIX.1c are concerned with the development of set of standards for system developers.


POSIX.1


  • This committee proposes a standard for a base operating system API; this standard specifies APIs for the manipulating of files and processes.

  • It is formally known as IEEE standard 1003.1-1990 and it was also adopted by the ISO as the international standard ISO/IEC 9945:1:1990

POSIX.1b


  • This committee proposes a set of standard APIs for a real time OS interface; these include IPC (inter-process communication).

  • This standard is formally known as IEEE standard 1003.4-1993.

POSIX.1c

  • This standard specifies multi-threaded programming interface. This is the newest POSIX standard.

  • These standards are proposed for a generic OS that is not necessarily be UNIX system.

  • E.g.: VMS from Digital Equipment Corporation, OS/2 from IBM, & Windows NT from Microsoft Corporation are POSIX-compliant, yet they are not UNIX systems.

  • To ensure a user program conforms to POSIX.1 standard, the user should either define the manifested constant _POSIX_SOURCE at the beginning of each source module of the program (before inclusion of any header) as;

  • #define _POSIX_SOURCE Or specify the -D_POSIX_SOURCE option to a C++ compiler (CC) in a compilation; % CC -D_POSIX_SOURCE *.C

  • POSIX.1b defines different manifested constant to check conformance of user program to that standard. The new macro is _POSIX_C_SOURCE and its value indicates POSIX version to which a user program conforms. Its value can be:

_POSIX_C_SOURCE VALUES


MEANING


198808L


First version of POSIX.1 compliance


199009L


Second version of POSIX.1 compliance


199309L


POSIX.1 and POSIX.1b compliance





  • _POSIX_C_SOURCE may be used in place of _POSIX_SOURCE. However, some systems that support POSIX.1 only may not accept the _POSIX_C_SOURCE definition.

  • There is also a _POSIX_VERSION constant defined in header. It contains the POSIX version to which the system conforms.

Dept of CSE, NIT Raichur




Download 12.87 Kb.

Share with your friends:




The database is protected by copyright ©ua.originaldll.com 2024
send message

    Main page