Comments (9)
Not sure if there's currently a way to set a flag to enable or disable dbg depending on whether or not it's a debug build
There is no flag or mechanism to do this.
I'm trying to follow a similar philosophy as the Rust team did with their dbg!(…)
macro.
Quoting from https://doc.rust-lang.org/std/macro.dbg.html
The dbg! macro works exactly the same in release builds. This is useful when debugging issues that only occur in release builds or when debugging in release mode is significantly faster.
Note that the macro is intended as a debugging tool and therefore you should avoid having uses of it in version control for longer periods.
This is why the dbg(…)
macro does not disable itself in non-DEBUG
builds.
That being said, I think I would be okay with adding a compile flag to disable the macro completely.
from dbg-macro.
I have hadded a DBG_MACRO_DISABLE
compile time flag that can be used to disable the macro.
If disabled, the macro can still be used in expressions since we define it to be dbg(x) = x
.
from dbg-macro.
woooow. ups. sorry. didnt know i was commenting on cpp repo.
i had this problem in rust and google sugested this repo and i clicked fast without looking.
from dbg-macro.
That's okay. Anyway, you should add something to the the macro when it is disabled, because a lot of "-Wunused-value" warnings appear in g++ and clang++, but that's different issue
from dbg-macro.
@fgallegosalido I have prepared CI for AppleClang, GCC and MSVC. We will see about those warnings.
from dbg-macro.
Anyway, you should add something to the the macro when it is disabled, because a lot of "-Wunused-value" warnings appear in g++ and clang++
Good point. Would you like to open a new issue for that?
from dbg-macro.
Okay, I'm opening it now
from dbg-macro.
i tried to run a mini project that has dbg!(), but it doesnt work
command is:
DBG_MACRO_DISABLE=1 cargo run -q -p ldebug
# also tried this
DBG_MACRO_DISABLE=true cargo run -q -p ldebug
program is:
fn main() {
let x = 123;
dbg!(x);
}
output
❱ DBG_MACRO_DISABLE=1 cargo run -q -p ldebug
[crates/ldebug/src/main.rs:25] x = 123
How am I supposed to run cargo run with this flag DBG_MACRO_DISABLE
?
from dbg-macro.
I think you're mixing this project up with the Rust macro of the same name (I believe this project was inspired by it). https://doc.rust-lang.org/std/macro.dbg.html
from dbg-macro.
Related Issues (20)
- Windows Supported? HOT 14
- Broken output of containers HOT 6
- How about output "{?}" string for unknown types instead of failing with static assert? HOT 2
- Allow specifying the output stream HOT 9
- Is support it for android ? HOT 2
- Is it possible to allow variadic template expansion? HOT 8
- VS2015:error C2912 HOT 5
- debug print on some condition HOT 3
- use in Qt HOT 1
- Add output level HOT 2
- `Type does not support the << ostream operator` on custom type HOT 10
- multithread support HOT 1
- Support always on colors HOT 2
- Nested dbg(...) expansion as not expected HOT 2
- How to force print the full content, not the one with ellipsis HOT 3
- Support for container adapters HOT 1
- Fails with Eigen matrices HOT 7
- Suggest /usr/local/include instead of /usr/include HOT 3
- Report a compiling error with old GCC version (GCC 4.8.5) HOT 1
- Some enhancement proposals for CMake based usecases HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbg-macro.