What is the use of the `inline` keyword in C?

A C code can be optimized in two ways: For Code size and for Execution Time. inline functions: gcc.gnu.org says, By declaring a function inline, you can direct GCC to make calls to that function faster. One way GCC can achieve this is to integrate that function’s code into the code for its callers. This … Read more

state machines tutorials [closed]

State machines are very simple in C if you use function pointers. Basically you need 2 arrays – one for state function pointers and one for state transition rules. Every state function returns the code, you lookup state transition table by state and return code to find the next state and then just execute it. … Read more

Is it possible to iterate over arguments in variadic macros?

Here is my homework of the day, it’s based on macro tricks and today I particularly learnt about __VA_NARG__ invented by Laurent Deniau. Anyway, the following sample code works up to 8 fields for the sake of clarity. Just extend the code by duplicating if you need more (this is because the preprocessor doesn’t feature … Read more

Printing null pointers with %p is undefined behavior?

This is one of those weird corner cases where we’re subject to the limitations of the English language and inconsistent structure in the standard. So at best, I can make a compelling counter-argument, as it’s impossible to prove it ๐Ÿ™‚1 The code in the question exhibits well-defined behaviour. As [7.1.4] is the basis of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)