Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 1 - Wrong place of definition for DEBUG macro. #266

Open
AlinGeorgescu opened this issue Apr 7, 2021 · 2 comments
Open

Assignment 1 - Wrong place of definition for DEBUG macro. #266

AlinGeorgescu opened this issue Apr 7, 2021 · 2 comments

Comments

@AlinGeorgescu
Copy link

AlinGeorgescu commented Apr 7, 2021

Assignment 1 - tracer_test.c:

1. #include "test.h"
2. #include "debug.h"
3. #include "util.h"
4.
5. #include "tracer.h"
6. #include "tracer_test.h"
7. #include "helper.h"
8.
9. /* use this to enable stats debugging */
10. #if 0
11. #define DEBUG
12. #endif

DEBUG is intended to be used for the print function (at least that is indicated in the comment on line 9). The print macro is defined in debug.h, which is included (line 2) earlier than the DEBUG macro is defined (line 11). I think this should be corrected.

One solution would be the following one, but I think this can be done more elegantly.

1. /* use this to enable stats debugging */
2. #if 0
3. #define DEBUG
4. #endif
5.
6. #include "test.h"
7. #include "debug.h"
8. #include "util.h"
9.
10. #include "tracer.h"
11. #include "tracer_test.h"
12. #include "helper.h"
@dbaluta
Copy link
Member

dbaluta commented Apr 12, 2021

@AlinGeorgescu thanks for reporting this. I think this should be completely removed and use a Makefile -DDEBUG option to enable debug.

@AlinGeorgescu
Copy link
Author

That's a solution, too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants