Month: August 2020

Interesting Facts about Macros and Preprocessors in C – GeeksforGeeks

One of the phase in compilation is pre processor replacement. In C programming there are multiple pre processor directives. The common one are include and define. There could be other directives like pragma and others which are compiler supported ones and may not be supported in all the compilers.

#include directive can be used to include the header files. If the header files are included <> brackets, the header file will be searched in the standard include paths mentioned as part of compilation with -I option. If the header files are used within double quotes “”, the current path will be used to search first before searching the standard paths.

#define will replace all the tokens with the values defined for the token.

Source: Interesting Facts about Macros and Preprocessors in C – GeeksforGeeks

Assertions in C/C++

Assertions help programmers to test conditions and abort the programs. Mainly used when the code cannot execute further if the condition is not met.

The syntax of assert is

void assert(scalar expression);

Need to include the following header which defined the
assert macro.

#include <assert.h>

Assert prints the error message to standard error
and terminates the program by calling abort(3).

code

assert( val == 0)

output

prog: some_file.c:16: some_func: Assertion `val == 0' failed.

Assertions can be turned off by defining NDEBUG macro. Adding NDEBUG will cause assert not to generate any code to print error and abort.

Recommendation is to not use the NDEBUG macro if using assert to detect error conditions as software may behave non-deterministically.

Source: Assertions in C/C++ – GeeksforGeeks

Inventec Introduces Entei, the Advanced Storage Server System

To match an ever-growing need for data storage space, Inventec (2356.TW), one of the key suppliers of world’s leading server brands, hyperscale data centers and server system integrators, announced the arrival of Entei – a 2U24Bay Storage Server System to support dual 2nd Gen Intel Xeon Scalable processors.

Source: Inventec Introduces Entei, the Advanced Storage Server System