C Programming Idioms ==================== Misc Topics ----------- Attributes https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax Variable Arguments https://www.cplusplus.com/reference/cstdarg/va_start/ Sys Types Defined in https://man7.org/linux/man-pages/man0/sys_types.h.0p.html lvalue and rvalues ------------------ lvalue is anything that can appear in the left side of an assigment expression. More technically, an lvalue is an expression referring to a region of storage. That includes #. Named Variables #. A dereferenced pointer (\*ptr) that does not refer to an array #. A subscript expression (arx[0]) that does not evaluate to an array #. A struct Member access (strx -> member) or (strx.member) the following examplea shows how a function can return an lvalue that can essentially be treated like an int variables. The memory of such lvalues must be allocated on the heap .. code-block:: C int* create_stuff(){ int *dtx = malloc(sizeof (int)); *dtx = 3; return dtx; } #define stuff (*create_stuff()) int main(int argc, char **argv, char *envp[]){ printf("k = %d\n",stuff); printf("k = %d\n",stuff=10); return 0; } This does a similar effect by returning a structure pointer .. code-block:: C struct mystuff { int x; }; struct mystuff* create_stuff(){ struct mystuff *dtx = malloc(sizeof (struct mystuff)); dtx -> x = 3; return dtx; } #define stuff (create_stuff()->x) int main(int argc, char **argv, char *envp[]){ printf("k = %d\n",stuff); printf("k = %d\n",stuff=10); }