The ANSI C standard doesn't seem to explicitly specify any details on the API for complex arithmetic operators (+,-,*,/), though it seems that the implementation allows use of these primitives. I'm wondering how this is possible, since C does not implement the concept of operator overloading? My thought is that an implementation of the macros specifying the complex
type will most likely utilize a built-in type which does permit such operations, but I then wonder how a complex number could permit the same range of values as, e.g., a single floating-point number (since it would have to somehow be represented as a pair of these, I would think its range would be cut in half)?
Am I thinking along the right lines, or am I way off on this one?
C does have operator overloading -- even before the C89 standard, it overloaded operators like
+
,-
,*
, and/
for both integer and floating point operations.C does not have user defined operator overloading -- so there are just the fixed set of overloads defined in the standard and no way to extend them.
C99 just extends the int/float overloading of operators to complex numbers. There's still no way for a program to extend the overloading beyond that specified in the spec.