Is D a cult?

Walter Bright newshound1 at digitalmars.com
Mon Mar 8 03:37:55 PST 2010


grauzone wrote:
> Walter Bright wrote:
>> bearophile wrote:
>>> Walter Bright:
>>>> There are significant technical problems with having functions 
>>>> return tuples.<
>>>
>>> A possibly stupid question: isn't it enough to return a custom struct?
>>
>> No, because of the alignment mismatches with other uses of tuples.
> 
> I don't understand, what does alignment have to do with such a high 
> level construct?

You can use a tuple to populate a struct with fields, and it's 
interchangeable with manually populating the fields. You can also use a 
tuple to pass args to a function, and it's interchangeable with manually 
listing the args.

But if you populate a struct with a tuple, then pass the struct as an 
arg, it is *not* interchangeable with manually listing the args, as the 
alignment is different.



More information about the Digitalmars-d mailing list