doc/conventions.txt: Exceptions

master
Perttu Ahola 2014-10-30 03:29:36 +02:00
parent 6c25e2421f
commit e78aad642b
1 changed files with 14 additions and 8 deletions

View File

@ -34,14 +34,6 @@ headers in src/ports/.
Function naming:
- Suffix _u: Unsafe, not included in public interface
Do not use assert(); throw anonymous exceptions instead:
- if(fail) throw Exception("Thing failed");
In normal operation, zero exceptions should be thrown. Unless any potential bugs
are occurring, you should be able to play the game fine if you set a breakpoint
on a GCC Linux build to __cxa_throw, which will stop the program immediately
when an exception occurs.
Naming:
- "type": Numeric id representing a type
- "name": A string; generally works as an identifier but not necessarily
@ -63,6 +55,20 @@ Ordering of #include directives:
5) STL headers, <>
6) System headers, <>
Exceptions
----------
Do not use assert(); throw anonymous exceptions instead:
- if(fail) throw Exception("Thing failed");
In normal operation, zero exceptions should be thrown. Unless any potential bugs
are occurring, you should be able to play the game fine if you set a breakpoint
on a GCC Linux build to __cxa_throw, which will stop the program immediately
when an exception occurs.
Exceptions are allowed to occur when a resource has expired that the caller had
to expect to still be valid in order to avoid some kind of ridiculous code
structure.
Non-exception throwing and exception-throwing methods
-----------------------------------------------------
- get_x: Returns nullptr or equivalent if not found