Converting C/C++ Code to D (#define extern)
Serg Kovrov
kovrov at no.spam
Tue Sep 26 07:03:11 PDT 2006
Hi Hasan Aljudy, you wrote:
> I remember a long while ago I read something about writing macro
> functions like this. I forgot why you have to add do while(0) but it's a
> trick to make the macro a /little bit/ more robust ...
You right, it is exactly robustness issue.
I think I understand now why - to use such multi-line macro with
'bracesless' (that is, one line) case of statements if/for/while. It is
ugly-looking, but perhaps useful hack.
PS. good thing, we can learn here not just D stuff, but in fact other
languages tricks as well =)
--
serg.
More information about the Digitalmars-d-learn
mailing list