Function return values in GMP?

Daniel J Farrell daniel.farrell at imperial.ac.uk
Mon Feb 27 13:56:07 CET 2006


I have written such a wrapper using Apple's Cocoa framework in the  
Objective-C language.

If your interested in knowing more let me know.

  Daniel.

On 27 Feb 2006, at 06:11, Hans Aberg wrote:

> On 27 Feb 2006, at 01:12, Décio Luiz Gazzoni Filho wrote:
>
>>> Even when using C++, it is unwise to return values, especially for
>>> dynamically allocated variables, due to the time it takes, unless
>>> one uses some kind a reference method (like a reference count).
>>
>> mpz_t is a pointer type, so that's a non-sequitur. It really comes
>> down to the points made in the previous email -- syntactic sugar
>> vs. flexibility of memory management.
>
> I mean in the C++ appropriate wrapper, of course. Then you can not
> use pointers as a substitute for return values, as new memory
> allocations may be needed, and then will require cleanup. Try to
> make, for example, a class "integer", with an
>    integer operator+(const& integer, const& integer);
> so see what happens.
>
>    Hans Aberg
>
>
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at swox.com
> https://gmplib.org/mailman/listinfo/gmp-discuss



More information about the gmp-discuss mailing list