C Norm

Foreword

The norm is not a constraint.

The norm is a safeguard to guide you in writing a simple C.

Why a norm is needed ?

The norm has two main goals:

The norm

Naming convention

Required :

Advised :

Format

Required :

Advised :

Function

Required :

Advised :

Headers

You must follow this rules ( umich.edu for more details) :

Comments

Required :

Not recommended :

Examples :

/*
 * Normal comment
 * with multiple lines
 */

/* Normal comment with one line  */

Others

Forbidden :

Not recommended :

Authorized :

Norm headers

Example of .h header

/******************************************************************************
 *
 * File Name        : test.h
 * Created By       : Alexandre ZANNI
 * Creation Date    : 06/01/2016
 * Last Changed By  : Alexandre ZANNI
 * Last Change      : 06/01/2016 19:07:46
 * Description      :
 * Version          : 1.0
 * Revision         : none
 *
 ******************************************************************************
 */

Exemple of makefile header

###############################################################################
# File Name       : Makefile                                                  #
# Created By      : Alexandre ZANNI                                           #
# Creation Date   : 06/01/2016                                                #
# Last Changed By : Alexandre ZANNI                                           #
# Last Changed    : 06/01/2016 19:07:46                                       #
# Description     : Provides compilation automation to the project            #
###############################################################################

makefile file

Required :

Example of makefile file

#### DEFAULT PARAMETERS ####
EXECUTABLE=main.out
SOURCES=main.c
CFLAGS= -Wall -ansi -pedantic
LDFLAGS=
CC=gcc
OBJECTS=$(SOURCES:.c=.o)

#### CUSTOM PARAMETERS ####
#<NAME>(CAPS LOCK)=your parameters

#### DEFAULT TARGETS ####
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
    $(CC) $(LDFLAGS) $(OBJECTS) -o $(EXECUTABLE)

clean:
    rm $(OBJECTS) $(EXECUTABLE)

#### CUSTOM TARGET ####
#<Action Name>:
#    Action 1
#    Action 2
#    Action X