doc/conventions.txt: Exceptions
This commit is contained in:
parent
6c25e2421f
commit
e78aad642b
@ -34,14 +34,6 @@ headers in src/ports/.
|
|||||||
Function naming:
|
Function naming:
|
||||||
- Suffix _u: Unsafe, not included in public interface
|
- 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:
|
Naming:
|
||||||
- "type": Numeric id representing a type
|
- "type": Numeric id representing a type
|
||||||
- "name": A string; generally works as an identifier but not necessarily
|
- "name": A string; generally works as an identifier but not necessarily
|
||||||
@ -63,6 +55,20 @@ Ordering of #include directives:
|
|||||||
5) STL headers, <>
|
5) STL headers, <>
|
||||||
6) System 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
|
Non-exception throwing and exception-throwing methods
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
- get_x: Returns nullptr or equivalent if not found
|
- get_x: Returns nullptr or equivalent if not found
|
||||||
|
Loading…
x
Reference in New Issue
Block a user