The Problem: You're writing a program for multiple platforms. As a result you have a lot of #ifdef statements sprinkled through out the code. So many in fact that they are make things look ugly and the code is hard to read. For example: void send_cmd(void) { send_cmd_start(); #ifdef FE_TEXTURE send_texture(); #endif /* FE_TEXTURE */ #ifdef FE_COLOR send_background(); if (foreground != TRANSPARENT) send_foreground(); #endif /* FE_COLOR */ #ifdef FE_SIZE if (size != 0) send_size(); #endif /* FE_SIZE */ #ifdef FE_REPLAY if (prev_cmd == '\0') { prev_cmd = cur_cmd; prev_param = cur_param; } #endif /* FE_REPLAY */ send_cmd_end(); }
The Problem: You're writing a program for multiple platforms. As a result you have a lot of #ifdef statements sprinkled through out the code. So many in fact that they are make things look ugly and the code is hard to read. For example: void send_cmd(void) { send_cmd_start(); #ifdef FE_TEXTURE send_texture(); #endif /* FE_TEXTURE */ #ifdef FE_COLOR send_background(); if (foreground != TRANSPARENT) send_foreground(); #endif /* FE_COLOR */ #ifdef FE_SIZE if (size != 0) send_size(); #endif /* FE_SIZE */ #ifdef FE_REPLAY if (prev_cmd == '\0') { prev_cmd = cur_cmd; prev_param = cur_param; } #endif /* FE_REPLAY */ send_cmd_end(); }
Chapter5: Looping
Section: Chapter Questions
Problem 12E
Related questions
Question
The Problem: You're writing a program for multiple platforms. As a result
you have a lot of #ifdef statements sprinkled through out the code. So many in
fact that they are make things look ugly and the code is hard to read.
For example:
void send_cmd(void)
{
send_cmd_start();
#ifdef FE_TEXTURE
send_texture();
#endif /* FE_TEXTURE */
#ifdef FE_COLOR
send_background();
if (foreground != TRANSPARENT)
send_foreground();
#endif /* FE_COLOR */
#ifdef FE_SIZE
if (size != 0)
send_size();
#endif /* FE_SIZE */
#ifdef FE_REPLAY
if (prev_cmd == '\0') {
prev_cmd = cur_cmd;
prev_param = cur_param;
}
#endif /* FE_REPLAY */
send_cmd_end();
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT