anonymus struct or class instances as arguments

Leopold Walkling leopold_walkling at web.de
Thu Dec 7 21:48:41 PST 2006


Karen Lanrap schrieb:
> Leopold Walkling wrote:
> 
> 
>> Also there isn't a way to create a struct, only by giving its
>> values.
> 
> I use it along this lines:
>> struct A {
>>     int i;
>       static A opCall(int p)
>       {
>           A retval;
>           retval.i = p;
>           return retval;
>       }
>> }
> 
>> void funk(A);
>>
>> int main() {
>        funk= A(9);
>>      return 0;
>> }

Yes, I use them too, and they really do a good job. But I'm bothering 
about the performance because first you can't be sure that they are 
inlined, second you have to implement them and for example if you use a 
struct you didn't create that doesn't have this, what can you do.
Also I wonder what is behind this opCall, how far they're optimized and 
inlined. I suppose that they create additional operations



More information about the Digitalmars-d mailing list