Converting C/C++ Code to D (#define extern)

Hasan Aljudy hasan.aljudy at gmail.com
Tue Sep 26 05:22:51 PDT 2006



Serg Kovrov wrote:
> Serg Kovrov wrote:
>> do
>> {
>>   PieceList(pos, to) = PieceList(pos,from);
>>   PrevPiece(pos, NextPiece(pos, to)) = to;
>>   NextPiece(pos, PrevPiece(pos, to)) = to;
>> }
>> while(0);
> 
>> Although later is somewhat suspicious - how loop meant to break?. 
>> Perhaps there is another macro called as function, that has a break 
>> statement. You could investigate what exactly it should do and rewrite 
>> it more clear.
> 
> How stupid of me =)
>> do {...} while(0);
> will be called exactly one time, but it has no sense to me either...
> 

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 ...



More information about the Digitalmars-d-learn mailing list