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

Per Nordlöw per.nordlow at gmail.com
Wed Aug 19 14:07:11 UTC 2020


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));



More information about the Digitalmars-d mailing list