[Added] Ability to customize the display of notifications (& more)

Moderator: GZDoom Developers

Re: Ability to customize the display of notifications (& mor

Postby Graf Zahl » Fri Aug 23, 2019 4:31 pm

Chris wrote:TL;DR locales in C/C++ suck. Probably better to find a string or character handling library that better understands and works with Unicode/UTF-8/16/32.


Indeed. I wonder why they had to cook up something this totally and fundamentally useless. Most importantly, why is the locale global state? That alone will create all the same problems that have been plaguing OpenGL to the point that it got superseded.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Ability to customize the display of notifications (& mor

Postby dpJudas » Sat Aug 24, 2019 2:18 am

Some of that can be explained by ancient 1980's origins of the C runtime that C++ was based on. The odd thing is that they can't even decide to make unicode part of the standard, because even today you can't actually specify a locale without it being implementation specific.

I completely agree with Chris that the solution is to simply avoid using it at all. For me, std::string is a basic container (that I always put utf-8 into, regardless of the locale) and the only other text related stuff I might use from the standard library only comes into play if its basically locale agnostic (like std::to_string(int)).
dpJudas
 
 
 
Joined: 28 May 2016

Re: Ability to customize the display of notifications (& mor

Postby Graf Zahl » Sat Aug 24, 2019 3:08 am

Considering that even the entire printf family is locale dependent, there's not much that can really be used here. I already had my fun with code breaking because the locale was set to the local country for 'proper' formatting of numbers, but totally overlooked that this renders internal text processing with floats inoperable.

These standards committees are an odd bunch. They seem so fixated at compatibility with theoretical systems that they totally lose focus of practical concerns.
This here's a good point. Apparently they want to keep things compatible with other theoretical encodings by not making an Unicode dependency. Why even use wide chars if not?
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Ability to customize the display of notifications (& mor

Postby _mental_ » Sat Aug 24, 2019 5:21 am

Here is how custom iswalpha() can be implemented. Alternatively, it's possible to code it as a huge number of if's, with or without table creation at runtime.
_mental_
 
 
 
Joined: 07 Aug 2011

Previous

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest