[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Why are standard (*, +, etc) operators not overloaded for
From: |
Gideon Simpson |
Subject: |
Re: [Help-gsl] Why are standard (*, +, etc) operators not overloaded for complex numbers in C++ |
Date: |
Sun, 28 Jan 2018 13:38:18 -0500 |
Didn't ANSI C99 add a complex type, _Complex_I? Not sure if it supports
overloading.
On Sun, Jan 28, 2018 at 1:01 PM, John D Lamb <address@hidden> wrote:
> On 27/01/18 19:38, Vincent Vandalon wrote:
>
>> Dear All,
>>
>> I am curious why the standard binary operators are not overloaded for the
>> gsl_complex type in C++; I presume this overloading is omitted
>> intentionally (since you can quickly write them yourself). Was the choice
>> to omit overloaded operators mainly driven by the desire to avoid
>> accidentally/non-explicit casting of a built-in type to gsl_complex?
>>
> Presumably because gsl is written in C.
>
> I don’t think C has a complex type. In any case the C++ complex type seems
> to be difficult to make compatible with the gsl representation while
> maintaining the original code in C.
>
> I realise it is possible to do some sort of conversion/casting in C++. But
> this is not likely efficient.
>
> --
> John D Lamb
>
>
--
gideon