Bikeshed:

The corner brackets (0x300c, 0x300d) perhaps.

double absa = ćać;

I would have rather liked, if brackets for abs would have a vertical symmetry axis (than the rotational symmetry).

However, I agree with Tom: if we were going to add more operators to the language, this wouldn't be my first choice.

-----Ursprüngliche Nachricht-----Von:Tom Honermann via Std-Proposals <std-proposals@lists.isocpp.org>Gesendet:Fr 24.11.2023 05:31Betreff:Re: [std-proposals] Unary operator | (absolute value of)An:std-proposals@lists.isocpp.org;CC:Tom Honermann <tom@honermann.net>;

I don't see a lot of motivation for this feature, but if we were to pursue a notation for this, a bracket notation would allow more expressiveness and would be more inline with common mathematical notation.

int a = ...;

int b = ...;

int c = |b-a|;Unfortunately, '|' (U+007C VERTICAL LINE) isn't available to be repurposed like this. There are a couple of other options.

' ā£' (U+2223 DIVIDES) is available, but it isn't intended for use as an absolute value symbol and its similarity to U+007C makes use of it a questionable choice.

'ā' (U+2016 DOUBLE VERTICAL LINE) is available, but that character is generally used to express a mathematical norm and that is not the same as the absolute value.

None of these options provides distinct characters for left vs right ends of the notation, so would require parenthesis when nested.

Other Unicode characters could of course be employed for a new syntax, but meh, abs() already exists and if we were going to add more operators to the language, this wouldn't be my first choice.

Tom.

On 11/23/23 5:43 PM, Rik van der Brugghen via Std-Proposals wrote:Hi.Maybe suggested before, but would be great witha = |b; // a = abs (b)That's it, exactly same semantic behaviour (precedence and all that stuff) as ~b.Best regards,Rik van der BrugghenStockholm

-- Std-Proposals mailing list Std-Proposals@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals