Albany Programming Course Supplement

Advanced Misconceptions or Confusions

Structure of Code and Structure of Data

In C applications, macros are used both within data structure definition code and executable code. The same syntax is used: Braces for grouping and semicolons for termination.

 A Linux Kernel class assignment: Make a team report that explains how the container_of macro works, preferably using a data structure diagram.

 #define container_of(ptr, type, member) ({                      \
        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
        (type *)( (char *)__mptr - offsetof(type,member) );})
The container_of macro expands to a C-code block.  The first statement declares and initializes a local variable; the second statement is an expression statement. Confusion was indicated by several teams presented attempts to diagram this block as a data structure.

Formatted and Binary Data

What printf/sprintf style formatting actually does, when inserting data given by parameters into a string.

There has been error in communication with booki server. Not sure right now where is the problem.

You should refresh this page.