The C Standards

Requirements:
Some memory 😉

Intro:
The C Programming language is a very simple, yet very complex language/
There is a standard documentation that should be referenced because it teaches
good programming practice, plus , it is the documentation for every function in
the C Library. Today I will be going over some of it. I will bring up two sites:

C Standard Specifications

Click to access n1548.pdf

and

Posix Standard
http://pubs.opengroup.org/onlinepubs/9699919799/

The C Standard provides several headers which functions the c runtime contains.
It also defines the way the environment is created, the way you define the main
function, the way variables work, and more. In my very first C Lesson, I recited
section 5.1.2.2.1 : Program Startup where it states that int main(void) needs to be
defined as that or int main(int argc, char *argv[]). It also states that it can
be implementation defined. The Common C Functions i had wrote about in a previous
tutorial, they are all defined here, for the developers of the c libraries such
as glibc, libc (freeBSD), dietlibc, and many more, they use this to implement
the body of the function to be built, linked into a libc linkable object, and
later linked to a another program.

Looking into one part, the section 5.2.2 : Character Display Semantics, it
shows you all of the escape sequences you will find in printf :

1 The active position is that location on a display device where the next
character output by the fputc function would appear. The intent of writing a
printing character (as defined by the isprint function) to a display device
is to display a graphic representation of that character at the active
position and then advance the active position to the next position on
the current line. The direction of writing is locale-specific. If the
active position is at the final position of a line (if there is one), the \
behavior of the display device is unspecified.

2 Alphabetic escape sequences representing nongraphic characters in
the execution character set are intended to produce actions on display devices as
follows:

\a ( alert) Produces an audible or visible alert without changing the active
position.
\b
( backspace ) Moves the active position to the previous position on the current
line. If the active position is at the initial position of a line,
the behavior of the display device is unspecified.
\f
( form feed) Moves the active position to the initial position at the
start of the next logical page.
\n
( new line ) Moves the active position to the initial position of the next line.
\r
( carriage return ) Moves the active position to the initial position of the
current line.
\t
( horizontal tab ) Moves the active position to the next horizontal
tabulation position on the current line. If the active position is at
or past the last defined horizontal tabulation position, the behavior of the
display device is unspecified.
\v
( vertical tab ) Moves the active position to the initial position of
the next vertical tabulation position. If the active position is at or
past the last defined vertical tabulation position, the behavior of the display
device is unspecified

These documentations are extremely useful for programmers, and vital for C
Runtime Libraries such as glibc , as those are the guidelines to create runnable
C Programs. The implementation is defined by the library.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s