Sha256: e1118171515abbff69ff8560ea0ab30c8622227142ca509f3c86bd16b49163f7

Contents?: true

Size: 1.25 KB

Versions: 50

Compression:

Stored size: 1.25 KB

Contents

#if DEBUG
	#if __GNUC__
		attr_noreturn static inline void* __null_pointer_deref_error_message(
			const int line,
			const char* const restrict file,
			const char* const restrict function
		) {
			output_nullt_string("\nError in file ");
			output_nullt_string(file);
			output_nullt_string(", in ");
			output_nullt_string(function);
			output_nullt_string("(), on line ");
			output_u64(line);
			output_nullt_string(": dereferencing NULL pointer\n");
			exit(1);
		}
		
		#define DEREF(x) (((x) ? (*(x)) : (__null_pointer_deref_error_message(__LINE__, __FILE__, __func__), *((__typeof__(x))NULL))))
		#define DEREF_ASSIGN(x) (void)((!(x)) && __null_pointer_deref_error_message(__LINE__, __FILE__, __func__)), (*x)
		#define ARRAY_INDEX(x, i) DEREF((x) + (i))
		#define ARRAY_INDEX_ASSIGN(x, i) (void)((!(x)) && __null_pointer_deref_error_message(__LINE__, __FILE__, __func__)), (x)[i]
		#define ARROW(x, y) DEREF(x).y
		#define ARROW_ASSIGN(x, y) DEREF_ASSIGN(x).y
	#else
		#define __FASTER_DEREF  1
	#endif
#else
	#define __FASTER_DEREF  1
#endif

#ifdef __FASTER_DEREF
	#define DEREF(x) (*(x))
	#define DEREF_ASSIGN(x) (*(x))
	#define ARRAY_INDEX(x, i) (x)[i]
	#define ARRAY_INDEX_ASSIGN(x, i) (x)[i]
	#define ARROW(x, y) (x)->y
	#define ARROW_ASSIGN(x, y) (x)->y
#endif

Version data entries

50 entries across 49 versions & 6 rubygems

Version Path
ufos-1.0.94 ./other/old_compiler/shiltium7 (2)/deref.h
aliens-1.0.94 ./other/old_compiler/shiltium7 (2)/deref.h
freespeech-1.0.94 ./other/old_compiler/shiltium7 (2)/deref.h
elonmusk-1.0.94 ./other/old_compiler/shiltium7 (2)/deref.h
politics-1.0.94 ./other/old_compiler/shiltium7 (2)/deref.h
democracy-1.0.94 ./other/old_compiler/shiltium7 (2)/deref.h
democracy-1.0.93 ./other/old_compiler/shiltium7 (2)/deref.h
ufos-1.0.91 ./other/old_compiler/shiltium7 (2)/deref.h
aliens-1.0.91 ./other/old_compiler/shiltium7 (2)/deref.h
freespeech-1.0.91 ./other/old_compiler/shiltium7 (2)/deref.h
elonmusk-1.0.91 ./other/old_compiler/shiltium7 (2)/deref.h
politics-1.0.91 ./other/old_compiler/shiltium7 (2)/deref.h
politics-1.0.89 ./other/old_compiler/shiltium7 (2)/deref.h
ufos-1.0.87 ./other/old_compiler/shiltium7 (2)/deref.h
aliens-1.0.87 ./other/old_compiler/shiltium7 (2)/deref.h
freespeech-1.0.87 ./other/old_compiler/shiltium7 (2)/deref.h
elonmusk-1.0.87 ./other/old_compiler/shiltium7 (2)/deref.h
politics-1.0.87 ./other/old_compiler/shiltium7 (2)/deref.h
ufos-1.0.88 ./other/old_compiler/shiltium7 (2)/deref.h
aliens-1.0.88 ./other/old_compiler/shiltium7 (2)/deref.h