medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit cc37839dccf8dfa44136c5087369aecb1cbb41a9
parent 00e3d8c8e71e418e030a012b2236d0c4ba5ed219
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat Mar 11 10:33:23 +0200

AT_STARTUP

Diffstat:
intrinsics.h | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/intrinsics.h b/intrinsics.h @@ -127,6 +127,13 @@ inline void assert_impl( const bool predicate, const char * message ) { #define CACHE_LINE_SIZE 64 #define CACHE_LINE_PADDING u8 COUNTER_NAME( cache_line_spacing )[ CACHE_LINE_SIZE ] +#define AT_STARTUP( code ) \ + namespace COUNTER_NAME( StartupCode ) { \ + static struct AtStartup { \ + AtStartup() { code; } \ + } AtStartupInstance; \ + } + #define ASSERT( predicate ) assert_impl( predicate, "\x1b[1;31massertion failed at " __FILE__ " line " STRINGIFY( __LINE__ ) ": \x1b[0;1m" #predicate "\x1b[0m" ) #if COMPILER_MSVC || __cplusplus >= 201103L