www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compile-Time Debugging with pragma(msg, ...) and Emacs Flycheck

If you're using Emacs Flycheck when coding D the following snippet

     pragma(msg, __FILE__, "(", __LINE__, ",1): Info: ", EXPRS...);

may come useful.

This inserts a preabmle before `EXPRS...` that is recognized by 
Flycheck as a compiler info diagnostics. Your message(s) 
`EXRPS...` will now show up inside the *Flycheck errors* buffer.

For instance, if you want to know the type of some variable `x` 
you can use

     auto x = f(); // returns some complex type
     pragma(msg, __FILE__, "(", __LINE__, ",1): Info: ", 
typeof(x));
Aug 19 2020