Function return values in GMP?

Décio Luiz Gazzoni Filho decio at decpp.net
Mon Feb 27 01:12:05 CET 2006


On Feb 26, 2006, at 8:52 PM, Hans Aberg wrote:

> On 27 Feb 2006, at 00:33, Décio Luiz Gazzoni Filho wrote:
>
>> On Feb 25, 2006, at 9:30 PM, James Wheaton wrote:
>>
>>> I find it very irritating and redundant that none of
>>> the GMP functions return GMP-type variables.
>
>> However, and especially considering
>> that C has no function overloading like C++ does, ...
>
> 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.

Décio


More information about the gmp-discuss mailing list