Coder Social home page Coder Social logo

Remove unused DEBUG macro about athena HOT 4 CLOSED

felker avatar felker commented on August 20, 2024
Remove unused DEBUG macro

from athena.

Comments (4)

tomidakn avatar tomidakn commented on August 20, 2024

I think it is OK to keep this option. However, the original policy of Athena++ is minimizing use of #ifdef. The problem of #ifdef is codes within the #ifdef - #endif block are not compiled and therefore not error checked (This is of course necessary for external library calls). Modern compilers should be able to optimize C++ if statements if they can be determined at the time of compilation. So I prefer to keep this policy, and encourage developers to use if instead of #ifdef as much as possible.

from athena.

tomidakn avatar tomidakn commented on August 20, 2024

Oh but to do so, we need to change
#define DEBUG to #define DEBUG 1

from athena.

felker avatar felker commented on August 20, 2024

@tomidakn I agree that if (DEBUG) { ...} is highly preferred to #ifdef DEBUG. But I wonder if we shouldn't also be very strict about how many if (DEBUG) { ...} sections get merged to master. And also, the switch might make more sense to be decoupled from compiling with -g. Sometimes you will want the debug symbols in your executable without a bunch of your verbose DEBUG code running. Although I guess in that case you can manually add the --cflag=-g instead of -debug convenience flag for configure.py

from athena.

tomidakn avatar tomidakn commented on August 20, 2024

This is a good point. Indeed, I agree that we should separate the debugger (-g) option and the DEBUG flag. Possibly, it may be better to have a separate DEBUG flag for each module. I also understand that it is better to reduce DEBUG codes as much as possible in the master.

I am not sure if this is the best yet, but one possibility is separating "debug" = less optimization and "verbose" = more diagnosis messages?

from athena.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.