13 ms·
I don't know if it's because I convinced myself a long time ago that I'll never be smart enough to write correct C/C++ code (though that hasn't (yet) stopped it
by ComputerGuru 11y ago
I don't know if it's because I convinced myself a long time ago that I'll never be smart enough to write correct C/C++ code (though that hasn't (yet) stopped it from being my primary development language) or if it's because I just because I'm a secret masochist, but I disagree with this proposal/suggestion.
Regardless of who is right and who is wrong in this matter, I think if everyone took a step back we could at least agree that it makes absolutely no sense to fix this on a (single Linux) distribution level. For Debian to configure/patch compilers on their platform to "narrow" undefined behavior is insane and ineffectual. Software isn't "validated" on/against a particular OS, it's validated on a compiler basis.
Breaking this assumption introduces a massive schism. While Debian is an amazing distro with plenty of clout (I'm a FreeBSD guy, but Debian comes second), it's terrifying to imagine a new generation of "cross-platform" C/C++ software that can only be verified working on Debian (or with Debian's fork/re-configured compiler). We've come so close to making truly cross-platfrom C++ code a reality (even bringing Windows, I repeat WINDOWS, into the fold) with C++11 (and the subsequent releases) and it's, in my humble opinion, utter folly to try and change the way code will fundamentally compile depending on the distribution you run.
If Debian cares, make a proposal to the C++ committee, bribe^H convince members to see their way (or threaten^H blackmail^H show them the dangers of continuing down the road they're on). Heck, fork C/C++ and call it E or C+++ or c-safe or something - or more reasonably - write a tool to convert C to rust or D-without-the-standard-library and announce only tools in that/those languages will be allowed in the standard distribution. But for Heaven's sake, please don't try to redefine C.
- anon4 11y agoOr they'll force the compiler writers' hand. See: EGCS.
- nix0n 11y agoIf you read the thread more thoroughly, Ian Jackson is actually more on the side of Debian leaving things the way they are upstream, while others are proposing that Debian enable Link Time Optimization for the sake of performance.
- maaku 11y agoIsn't that what Ian said in TFA?
- linuxlizard 11y ago"even bringing Windows, I repeat WINDOWS, into the fold" I am not a C++ expert but have tinkered with C++11. How will portable C++ work with the Windows UTF-16 (wchar_t) and other systems using UTF-8 (char_t)? Is there a way to have standard C++ portable across Windows' UTF-16 and !Windows UTF-8 without #ifdef'ing a char wrapper? edit: UTF-16 not UCS-16
- ComputerGuru 11y agoModern versions of Visual Studio allow you to configure your project as one of ASCII/UNICODE/MBCS. MBCS (multi-byte character set) is UTF8 compatible. TCHAR becomes char (instead of the usual wchar_t) and most APIs you call via their once-ANSI names (e.g. CreateFile being #ifdef'd to CreateFileA) will actually accept UTF8 instead. Unfortunately, APIs that were created when ASCII was declared dead and without an xxxxA counterpart still need manual mapping to the xxxxW functions instead (which is just plain stupid on MS' behalf).
- the_why_of_y 11y ago#ifdefing a leaky abstraction that can be either UTF-8 or UTF-16 would be pretty horrible to work with. For a more workable approach read this article, especially the section "How to do text on Windows". http://utf8everywhere.org/ http://utf8everywhere.org/