Alternative to C++ macro in D
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Sun Nov 3 17:18:19 UTC 2019
On Sunday, 3 November 2019 at 17:02:30 UTC, Vinod K Chandran
wrote:
> On Sunday, 3 November 2019 at 16:55:36 UTC, Vinod K Chandran
> wrote:
>> Hi all,
>> I can do this in C++.
>> #include <iostream>
>> using namespace std ;
>>
>> #define end };
>> #define log(x) cout << x << endl
>> #define wait std::cin.get()
>>
>>
>> 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.
>> Edit : How can add syntax highlighting and coloring in code
>> posted on this comment ?
>
> How can i edit my post ? There is no button or link to edit my
> post.
You can't, web version is just a frontend for mailing list.
Best regards,
Alexandru.
More information about the Digitalmars-d-learn
mailing list