Doctor's Diary: Three Cases of Choledochal Cysts.
Choledochal cysts are congenital cystic dilations of the biliary tree, most commonly located at the junction of the hepatic and common bile ducts. These are rare in the pediatric age group and are often misdiagnosed due to the presence of nonspecific symptoms. Here we present three cases of choledochal cysts that are successfully treated with transduodenal resection and primary anastomosis.Q:
Why are macro arrays so slow?
In a book I'm reading about C macros, I read that this:
#define MAX_NUM_NAMES 256
#define MAX_NUM_NAME_LENGTH 12
...is much slower than this:
static char names[MAX_NUM_NAMES][MAX_NUM_NAME_LENGTH];
I understand the intent of the author of the book, but I just don't see why it would be slower. What is so slow about the macro approach?
A:
One of the reasons is that the macro has to be expanded by the preprocessor when it is read by the compiler, which involves a number of steps. These include variable number of stages, initializing arrays to their initial value, etc.
An array that is defined inline in the source file, on the other hand, is only declared and initialized once, at the point it is defined, which is at the start of the compilation unit.
One example of what the preprocessor can do is the following:
#define NUM_STATES 16
#define NUM_ACTIONS 16
#define SCREEN(name) void(*state_actions[][NUM_STATES][NUM_ACTIONS])() = {\n \n {
Related links:
Comments