Change format of .txt to .md (Markdown)

This commit is contained in:
Victor Derks 2018-11-05 21:53:42 +01:00
parent 2e050eb9df
commit 4a0583087d

View File

@ -1,38 +1,35 @@
Style and Design
================
# Style and Design
Introduction
------------
## Introduction
The purpose of this document is to record the basic style and design guidelines of CharLS to ensure consistency and
to record decisions.
## Style
### Tabs and Spaces
Tabs and Spaces
---------------
Spaces with an indent of 4. This to ensure maximum readability with different editors/platforms.
To document this and ensure editors are configured correctly an .editorconfig is used in the root of the repository.
### 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 all main compilers MSVC, GCC, clang and many other compilers, but in essence a compiler extension.
2) #ifdef CHARLS_<FILENAME> \ #define CHARLS_<FILENAME> \ #endif construction.
* Given the industry acceptance, use method 1 (easier and less manual code).
## Exceptions and Error Handling
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.
=> Design: std::system_error is the standard solution to throw exceptions from libraries (CharLS is a library)