Style and Design
================

Introduction
------------

The purpose of this document is to record the basic style and design guidelines of CharLS to ensure consistency and 
to record decisions.


Tabs and Spaces
---------------
Spaces with an indent of 4. This to ensure maximum readability with different editors/platforms.


Exceptions and Error Handling
-----------------------------
* C++ Exceptions should be derived from std::exception. (Common accepted idom)
* The exception should be convertible to an error code to support the C API
* An english error text that describes the problem is extreme usefull.

=> Design: std::system_error is the standard solution to throw exceptions from libraries (CharLS is a library)


Template: class vs typename
---------------------------
The typename keyword is the prefered keyword to "mark" template variables.


Prevent header file double include
----------------------------------
There are 2 methods to prevent double include:

1) #pragma once. Supported by Visual Studio, GCC and many other compilers, but in essence a compiler extension 

2) #ifdef CHARLS_<FILENAME> \ #define CHARLS_<FILENAME> \ #endif construction.

* For maximum platform compatiblity, method 2 should be used.
