C++ Logo

sg16

Advanced search

Re: [isocpp-sg16] Unicode identifiers in the source code

From: Alisdair Meredith <alisdairm_at_[hidden]>
Date: Sun, 30 Jun 2024 13:29:40 -0400
If they are used widely in a specific code base, it is not that bad as they are easy to copy/paste.  Introducing them to a code base where there is no donor to copy/paste from could be frustrating though.

AlisdairM
อลิสแดร์ม
Sent from my iPhone

On Jun 30, 2024, at 13:13, Steve Downey via SG16 <sg16_at_[hidden]> wrote:


\N{Greek Capital Letter Omega} -- of course you have to look up that name, too. 

On Sun, Jun 30, 2024, 13:07 Tiago Freire via SG16 <sg16_at_[hidden]> wrote:

I would avoid characters that look like other things (′) those would definitely be a pain, also and °C will confuse somebody.

Otherwise, I wouldn’t prevent someone from using it if they wish to use it, but then again, I don’t have a Ω on my keyboard.

Yes, you can use a macro to type arbitrary Unicode characters on your keyboard, but truth be told I won’t be able to remember those, it ain’t happening.

In practice if I wanted to type those, I would have to look up the character and copy paste it, which is just too much work and would just stick up to ascii.

 

Just my 2¢

 

 

From: SG16 <sg16-bounces_at_[hidden]> On Behalf Of Mateusz Pusz via SG16
Sent: Sunday, June 30, 2024 16:56
To: SG16 <sg16_at_[hidden]>
Cc: Mateusz Pusz <mateusz.pusz_at_[hidden]>
Subject: [isocpp-sg16] Unicode identifiers in the source code

 

Hi,

 

During the recent LEWGI discussion on the units library, people in the room suggested that in addition to the regular "ASCII" version, we should also provide Unicode symbols for unit identifiers. It seems that with P1949R7, this could be possible.

 

However, when I tried this in the code, I was able to make the following work:

 

inline constexpr auto µΩ = micro<si::ohm>;

 

but not:

 

inline constexpr auto = degree_Celsius;

inline constexpr auto ° = degree;

inline constexpr auto ′ = arcminute;
inline constexpr auto ″ = arcsecond;

 

Are those outside of the supported range and should not be supported, or is it just the lack of proper support in the compilers I use (gcc-14 and clang-18)?

 

Even if this can work, is it a good idea?

 

Best

 

Mat

--
SG16 mailing list
SG16_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/sg16
--
SG16 mailing list
SG16_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/sg16

Received on 2024-06-30 17:30:11