• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:54
CEST 16:54
KST 23:54
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins Maestros of the Game 29ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12TL.net Map Contest #22 - Voting & Ladder Map Selection7
Community News
MC vs IdrA, Boxer vs Nal_rA to be Legacy Matches @ BlizzCon315.0.16 Hotfix (June 30) - Balance + Bug Fixes35Weekly Cups (June 22-28): Zergs thrive in new patch2[TLMC] Summer 2026 Ladder Map Rotation05.0.16 patch for SC2 goes live (8 worker start)99
StarCraft 2
General
MC vs IdrA, Boxer vs Nal_rA to be Legacy Matches @ BlizzCon Serral wins Maestros of the Game 2 5.0.16 Hotfix (June 30) - Balance + Bug Fixes HomeStory Cup In Early July 5.0.16 patch for SC2 goes live (8 worker start)
Tourneys
HomeStory Cup 29 Douyu Cup 2026: $20,000 Legends Event (June 26-28) Vespene Cup #1 — $300+ USD, July 10 Crank Gathers Season 4: BW vs SC2 Team League RSL Revival: Season 6 - Qualifiers and Main Event
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 532 Nuclear Family Mutation # 531 Experimental Artillery Mutation # 530 One For All
Brood War
General
ASL 22 Proposed Map Pool BW General Discussion Starcraft vs Retro Category on Twitch First season(s) of tastosis gomtv gsl vods? Best thing happen to StarCraft since Remastered?
Tourneys
The Casual Games of the Week Thread [Megathread] Daily Proleagues [ASL21] Grand Finals [BSL22] GosuLeague Casts - Tue & Thu 22:00 CEST
Strategy
Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies Why doesn't anyone use restoration?
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Summer Games Done Quick 2026! Nintendo Switch Thread ZeroSpace at Steam NextFest - Last free demo
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread TL Mafia Power Rank Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread Canadian Politics Mega-thread US Politics Mega-thread The Games Industry And ATVI Men's Fashion Thread
Fan Clubs
The HerO Fan Club! The herO Fan Club!
Media & Entertainment
Movie Discussion! Series you have seen recently... [Req][Books] Good Fantasy/SciFi books [TV/BOOK] *SPOILERS* Game of Thrones Discussion
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion McBoner: A hockey love story Cricket [SPORT]
World Cup 2022
Tech Support
How to clean a TTe Thermaltake keyboard? Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Listen To The Coaches!
TrAiDoS
An Exploration of th…
waywardstrategy
I'm an arrogant trash talke…
FlaShFTW
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 16159 users

The Big Programming Thread - Page 956

Forum Index > General Forum
Post a Reply
Prev 1 954 955 956 957 958 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Nars_
Profile Joined February 2016
31 Posts
Last Edited: 2018-04-21 00:34:21
April 21 2018 00:33 GMT
#19101
delete this post
Silvanel
Profile Blog Joined March 2003
Poland4768 Posts
April 21 2018 07:32 GMT
#19102
On April 20 2018 23:35 Excludos wrote:
Show nested quote +
On April 20 2018 23:32 Artesimo wrote:
Testing is for people who code too weak so they have to check if it works anyways

And yes, thats a quote which I got in response to me trying to convince someone how fun Mockito is for (java) testing.


Or the quote my boss gave me when I told him we desperately needed to implement some unit testing in our consistently breaking system. "You should have just made it better to begin with" and "We don't have time to do testing right now, the system needs to work first". The irony of the last statement was lost on him.

On a completely different topic: I'm starting in a new job next week xD


GZ on the new job.

In regards to "testing" this approach is only possible in small companies/projects where there might be no place for dedicated tester. In the end that means developers end up being their own testers. Which isnt very effective.
The larger the project, the more people involved, the larger and more numerous dependencies the greater is need for good testing strategy. And that usually involves people dedicated only to testing. Not to mention that if Your customer is another company with at least a little bit of knowledge about SW development they might just ask "What is Your testing strategy", and they wont take "we just write good code" for an answer.
Pathetic Greta hater.
bo1b
Profile Blog Joined August 2012
Australia12814 Posts
April 21 2018 08:29 GMT
#19103
Off topic question, but where do you guys think the future of computer science education will go. Currently it is possible to get a job of varying levels without a university education, some things are locked behind doors for the most part, such as machine learning jobs, or computer vision, or other things with a high level of research behind it.

Yet I go online and I find a variety of moocs with what looks like fairly excellent layouts for a cs education, such as:

https://github.com/P1xt/p1xt-guides/blob/master/cs-java-focus.md
https://github.com/ossu/computer-science
various online university courses, such as cs 50x

Do you think that completing some of those pathways will ever lead to a more difficult to get to job? Completing the ossu from start to finish is no joke, that really closes in on a university level education, plus a bit.
Silvanel
Profile Blog Joined March 2003
Poland4768 Posts
Last Edited: 2018-04-21 08:53:20
April 21 2018 08:52 GMT
#19104
Well from my experience the knowledge is held by specific companies not universisties (unless we talk about pure research stuff), there are some areas which only select few companies develop and only way inside such field is to join such company. And once inside the bar for changing position and learning is significantly lower.
Pathetic Greta hater.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2018-04-21 10:14:00
April 21 2018 10:09 GMT
#19105
I expect to re-learn quite a lot of basic stuff once quantum computer is mainstream. Will it invalidate a lot of our existing knowledge taught at computer science courses? Will our CS degrees be almost worthless?
Excludos
Profile Blog Joined April 2010
Norway8266 Posts
April 21 2018 10:18 GMT
#19106
On April 21 2018 16:32 Silvanel wrote:
Show nested quote +
On April 20 2018 23:35 Excludos wrote:
On April 20 2018 23:32 Artesimo wrote:
Testing is for people who code too weak so they have to check if it works anyways

And yes, thats a quote which I got in response to me trying to convince someone how fun Mockito is for (java) testing.


Or the quote my boss gave me when I told him we desperately needed to implement some unit testing in our consistently breaking system. "You should have just made it better to begin with" and "We don't have time to do testing right now, the system needs to work first". The irony of the last statement was lost on him.

On a completely different topic: I'm starting in a new job next week xD


GZ on the new job.

In regards to "testing" this approach is only possible in small companies/projects where there might be no place for dedicated tester. In the end that means developers end up being their own testers. Which isnt very effective.
The larger the project, the more people involved, the larger and more numerous dependencies the greater is need for good testing strategy. And that usually involves people dedicated only to testing. Not to mention that if Your customer is another company with at least a little bit of knowledge about SW development they might just ask "What is Your testing strategy", and they wont take "we just write good code" for an answer.


I disagree wholeheartedly. The most effective tester is the programmer himself. He knows exactly what every piece of his code/program is suppose to do, and can quickly dive in and fix it. That doesn't mean you don't need external testers as well, but those as more to test the program from a user's point of view rather than a tech savvy programmer's point of view (As well for the fact that a dedicated tester will have a lot more time for exactly that, while a programmer also has to..program). And all programmers do test, even if it's a bare minimum: They compile the program after writing a piece of code. But you could do so much more without eating into your feature list schedule, and automated testing is excellent for that. Unit testing and front end testing tools like Cypress are golden for making sure that all your user stories works like they are suppose to. So whenever your/my boss tells you that "There's no time for testing because nothing is working", he is showing a fundamental failure to understand what testing does: Making sure that stuff works. At that point the only solution is to find another job. Because I sure as hell aren't going to push untested features which could literally end up killing people or animals (We have already done the latter and have had some damn close near misses on humans too. I won't stick around for it)
Silvanel
Profile Blog Joined March 2003
Poland4768 Posts
April 21 2018 14:31 GMT
#19107
Well You can go to jail for something like that (like someone who makes shitty bridge and ends up killing people) so yeah better to avoid something like that. Not to mention it is unethical.
Pathetic Greta hater.
ShoCkeyy
Profile Blog Joined July 2008
7815 Posts
Last Edited: 2018-04-22 04:03:06
April 21 2018 17:15 GMT
#19108
I'm a programmer who works on strategy/architect for improved UX/UI and conversion now, with no CS degree (Thanks for that resource b1ob, taking a look), but have worked for multiple fortune 500 companies. The next thing is testing, I test all the time, I test other peoples code as well. Testing is important, just because you built it, doesn't mean you know everything. I've built many things that I figured always worked, but when I started to user test my applications, I quickly realized how users tend to break things anyways. So in the end, testing is extremely important. And don't always test yourself, you want others to test for you too.

Adding an extra edit: I do however believe getting a degree helps in a sense of experience building from nothing when you know nothing. It took me longer learning to build from scratch thats for sure.
Life?
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2018-04-22 20:57:53
April 22 2018 20:51 GMT
#19109
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?

Show nested quote +

3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D
Excludos
Profile Blog Joined April 2010
Norway8266 Posts
Last Edited: 2018-04-22 21:18:53
April 22 2018 21:16 GMT
#19110
On April 23 2018 05:51 sc-darkness wrote:
Show nested quote +
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?


3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D


Did I mention that I lo-o-o-ove Qt? All of these shitstained compatibility issues worked out behind my back without me having to worry about it.
sc-darkness
Profile Joined August 2017
856 Posts
April 22 2018 21:29 GMT
#19111
Well, I have to maintain MFC at a second job in a row. Oh well, we plan to get rid of it at some point.
Khalum
Profile Joined September 2010
Austria831 Posts
April 22 2018 22:49 GMT
#19112
On April 23 2018 05:51 sc-darkness wrote:
Show nested quote +
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?


3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D


I ported a ton of code to use boost::filesystem::path for paths instead of a seemingly random combination of char*, std::string, QString, ... last year. I don't know how I retained my sanity.
Excludos
Profile Blog Joined April 2010
Norway8266 Posts
April 23 2018 07:34 GMT
#19113
On April 23 2018 07:49 Khalum wrote:
Show nested quote +
On April 23 2018 05:51 sc-darkness wrote:
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?


3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D


I ported a ton of code to use boost::filesystem::path for paths instead of a seemingly random combination of char*, std::string, QString, ... last year. I don't know how I retained my sanity.


Why not use QPath or QFile when you already have Qt installed? Not that boost is bad, but I don't see a reason to use both of them as, to my knowledge, Qt covers everything boost does.
ddengster
Profile Blog Joined January 2009
Singapore129 Posts
Last Edited: 2018-04-23 08:10:14
April 23 2018 07:43 GMT
#19114
On April 23 2018 05:51 sc-darkness wrote:
Show nested quote +
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?


3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D


Read up utf8everywhere

As a rule of thumb, you use should using utf8 (std::string or char, preferably char arrays ) instead of wchar types in your code; only convert them when the windows API demands it. UTF8 is an encoding that contains all the ascii character plus the extended ones, see #7 of the article in the link. UTF16 also has a number of disadvantages, and the article lists that down as well.

There are open source code/libraries that do the conversion from utf8 to utf16 and vice versa, go find them. If you introduce another wstring type in your code, you'll have to spend a whole bunch of time writing versions of code for wstring types.

Edit: Also, do note that you need to adjust accordingly if you do string manipulation or want to use string lengths with utf8 characters.
Check out NEO Impossible Bosses, RTS-MOBA boss rush at http://neoimpossiblebosses.coder-ddeng.com
nunez
Profile Blog Joined February 2011
Norway4003 Posts
April 23 2018 10:08 GMT
#19115
On April 23 2018 16:34 Excludos wrote:
Show nested quote +
On April 23 2018 07:49 Khalum wrote:
On April 23 2018 05:51 sc-darkness wrote:
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?


3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D


I ported a ton of code to use boost::filesystem::path for paths instead of a seemingly random combination of char*, std::string, QString, ... last year. I don't know how I retained my sanity.


Why not use QPath or QFile when you already have Qt installed? Not that boost is bad, but I don't see a reason to use both of them as, to my knowledge, Qt covers everything boost does.

boost::filesystem was merged into standard c++ since c++17.
conspired against by a confederacy of dunces.
Khalum
Profile Joined September 2010
Austria831 Posts
Last Edited: 2018-04-23 11:23:23
April 23 2018 11:22 GMT
#19116
On April 23 2018 19:08 nunez wrote:
Show nested quote +
On April 23 2018 16:34 Excludos wrote:
On April 23 2018 07:49 Khalum wrote:
On April 23 2018 05:51 sc-darkness wrote:
On April 19 2018 02:48 sc-darkness wrote:
Ok, what the fuck is the problem with std::string and std::wstring on Linux and Windows?

I see that std::string is somehow magically "UTF-8 ready" on Linux. On the contrary, Windows prefers std::wstring for unicode. Yet, std::wstring is 4 bytes on Linux and only 2 bytes on Windows. How does that make std::wstring less desirable on Linux? Why? Clearly wstring is larger so it could hold more characters? And why is this fucked up on an OS level? I just don't understand all this mess.

Link: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Edit: Are we meant to use these now?


3) UTF-8 encoded string literal. The type of a u8"..." string literal is const char[].
4) UTF-16 encoded string literal. The type of a u"..." string literal is const char16_t[].
5) UTF-32 encoded string literal. The type of a U"..." string literal is const char32_t[].




Fuck the hacky 8-bit ASCII (a.k.a Windows code pages) backwards compatibility support on Windows and the shit it caused to Unicode support.

Code:
+ Show Spoiler +


#include <string>
#include <iostream>

int main()
{
std::string chinese_str = "新年快乐 / 新年快樂";
std::cout << chinese_str << std::endl;

std::cout << "Size of char: " << sizeof(char) << std::endl;
std::cout << "Size of wchar_t: " << sizeof(wchar_t) << std::endl;

return 0;
}



Linux:
+ Show Spoiler +

新年快乐 / 新年快樂
Size of char: 1
Size of wchar_t: 4

Linux uses UTF-8 by default.

Windows:
+ Show Spoiler +

???? / ????
Size of char: 1
Size of wchar_t: 2

Warnings:
+ Show Spoiler +

warning C4566: character represented by universal-character-name '\u65B0' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5E74' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u5FEB' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u4E50' cannot be represented in the current code page (1251)
warning C4566: character represented by universal-character-name '\u6A02' cannot be represented in the current code page (1251)


Windows uses UTF-16 by default but only for wstring not for string.

If we replace string with wstring, it still doesn't work with wcout. More work is necessary to make Windows Command Prompt to display it for you. Thank you Microsoft for screwing Unicode support. :D


I ported a ton of code to use boost::filesystem::path for paths instead of a seemingly random combination of char*, std::string, QString, ... last year. I don't know how I retained my sanity.


Why not use QPath or QFile when you already have Qt installed? Not that boost is bad, but I don't see a reason to use both of them as, to my knowledge, Qt covers everything boost does.

boost::filesystem was merged into standard c++ since c++17.


Aye. We're on c++11 but once we decide to switch we can use std::filesystem functionality -> less 3rd party dependencies -> good.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
April 23 2018 11:37 GMT
#19117
yes, exactly.
conspired against by a confederacy of dunces.
sc-darkness
Profile Joined August 2017
856 Posts
April 23 2018 17:36 GMT
#19118
Wasn't there a plan to support networking too? Shame it didn't make it.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
April 30 2018 03:39 GMT
#19119
I need a lot of help understanding Dagger 2. I've read a lot of guides and I don't understand DI in general.

You have an object you want to inject. You Provide it with @Provides inside of an @Module. You then use it somewhere else with @Inject. Is this correct so far?

If it is I'm failing to apply it to my cause and getting errors that aren't google-able.

In my case I am trying to inject an instance of a javax.crypto.KeyGenerator. I created a Module AppComponent with an @Provides KeyGenerator provideKeyGenerator(String walletName). I then want to @Inject this into another Class with certain parameters but I can't get that to work. I've tried a number of things, but keep running into problems injecting it, because it runs into problems injecting into a static field.

Does anyone have a good, basic guide for doing something like this? I feel like I'm running into a wall with this. I'll try to post some sample code tomorrow night to give this post an actual purpose.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Danehardin
Profile Joined April 2018
0 Posts
April 30 2018 21:51 GMT
#19120
--- Nuked ---
Prev 1 954 955 956 957 958 1032 Next
Please log in or register to reply.
Live Events Refresh
HomeStory Cup
11:00
XXIX - Group Stage Day 1
TaKeTV 2830
ComeBackTV 739
Ryung 537
TaKeSeN 373
SteadfastSC322
IndyStarCraft 223
Rex131
EnkiAlexander 58
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Ryung 537
SteadfastSC 322
IndyStarCraft 216
Rex 123
mouzStarbuck 40
StarCraft: Brood War
Britney 38189
Shuttle 1534
Mini 823
BeSt 732
firebathero 663
Soma 524
ToSsGirL 508
Hyuk 427
Snow 351
EffOrt 346
[ Show more ]
Leta 215
actioN 192
Rush 160
Mong 141
Aegong 123
hero 76
Pusan 74
Sea.KH 73
soO 54
Terrorterran 43
Free 43
JYJ 43
Sharp 39
scan(afreeca) 29
HiyA 23
910 22
Barracks 21
IntoTheRainbow 19
Bale 17
Noble 17
GoRush 16
zelot 14
Sacsri 12
Rock 11
Dota 2
qojqva2283
LuMiX1
Counter-Strike
kRYSTAL_31
Super Smash Bros
Mew2King106
Westballz45
Heroes of the Storm
Khaldor3
Other Games
singsing4253
XcaliburYe307
byalli295
DeMusliM282
KnowMe87
Hui .5
Organizations
Dota 2
PGL Dota 2 - Main Stream211
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• escodisco3257
• Michael_bg 16
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3972
• TFBlade850
Upcoming Events
Replay Cast
9h 6m
HomeStory Cup
20h 6m
Replay Cast
1d 9h
HomeStory Cup
1d 20h
OSC
1d 22h
Sparkling Tuna Cup
2 days
WardiTV Weekly
3 days
The PondCast
4 days
Replay Cast
5 days
CrankTV Team League
5 days
[ Show More ]
Replay Cast
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

YSL S3
Douyu Cup 2026
Murky Cup 2026

Ongoing

IPSL Spring 2026
Acropolis #4
CSL Season 21: Qualifier 2
Escore Tournament S3: W1
SCTL 2026 Spring
HSC XXIX
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026

Upcoming

CSL 2026 Summer (S21)
Escore Tournament S3: W2
ASL Season 22:Wild Card Qualifier
CSLAN 4
Blizzard Classic Cup 2026
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Eternal Conflict S2 E2
Heroes Pulsing #3
Eternal Conflict S2 E1
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.