Alternative to C++ macro in D

Sebastiaan Koppe mail at skoppe.eu
Sun Nov 3 19:04:47 UTC 2019


On Sunday, 3 November 2019 at 16:55:36 UTC, Vinod K Chandran 
wrote:
> int main() {
>     log("Trying to avoid the visual clutter aused by closing 
> curly braces") ;
>     string myStr = "Now, code looks more elegant" ;
>     log(myStr) ;
>     wait ;
> end
> How can i do this in D ? Especially the " #define end }; ". 
> I've tried " alias end = } " but didn't worked.

You can't. D deliberately doesn't have a preprocessor. `#define 
end };` is one of the reasons.


More information about the Digitalmars-d-learn mailing list