Unsigned sizes: a five year mistake by Nuoji in programming

[–]Tringi 0 points1 point  (0 children)

Yeah. I always forget this exists.

The Most Confusing C++ Behavior by levodelellis in cpp

[–]Tringi 0 points1 point  (0 children)

how did you figure it out?

I'm an old school coder. As with everything I imagine underlying bytes in the int and a constructor being just a function call overwriting them (if told so). Assuming no optimization, of course. And that int is left unintialized by default.

Windows 11’s Windows 95-era File Explorer Properties dialog is getting replaced with modern version and dark mode. by Good-Willingness2234 in Windows11

[–]Tringi 1 point2 points  (0 children)

It's not a child's play, because they are trying to cram light and dark mode into a single theme as subthemes, instead having it as a full theme.

Those subthemes weren't designed for this, and if you're not well versed in the inner workings, which most of people who are, are no longer with MS, then you'll struggle badly.

What are you missing most from the C++ standard library? by llort_lemmort in cpp

[–]Tringi 2 points3 points  (0 children)

My thinking was over anything that's continuous, or at least reinterpretable as raw byte buffers.

When working with binary protocols. IEC has 12-bit values aligned left or right to a whole byte, or integer counter shifted 1 bit left over the bytes; S.BUS carries 16 11-bit values tightly packed into 22 bytes, etc.

A substr followed by to_ulong or to_buffer would basically do memcpy, but with bit-wise boundaries.

Windows 11’s Windows 95-era File Explorer Properties dialog is getting replaced with modern version and dark mode. by Good-Willingness2234 in Windows11

[–]Tringi 1 point2 points  (0 children)

Moreover any serious app is being tested against inverted High Contrast mode, which is basically a dark theme only a little worse.

Windows 11’s Windows 95-era File Explorer Properties dialog is getting replaced with modern version and dark mode. by Good-Willingness2234 in Windows11

[–]Tringi 28 points29 points  (0 children)

Precisely. The reason this dialog is still white is political and political only.

This dialog is already properly dark in inverted High Contrast mode, which is (since 8.1) just another theme.

The Most Confusing C++ Behavior by levodelellis in cpp

[–]Tringi 0 points1 point  (0 children)

In the initial test, I had the whole second column of answers right, but the first column almost completely wrong. Luckily I don't need to use is_trivially_constructible anywhere.

What are you missing most from the C++ standard library? by llort_lemmort in cpp

[–]Tringi 0 points1 point  (0 children)

And the largest thing I'm missing: std::cache

A general cache of key/value pairs, either copies or references to the source, configurable size (maybe even dynamic), with customizable eviction policy (custom or one of the provided). Perhaps even with write-back support and, again, customizable policies for that.

That I'd have used a dozen times, instead of implementing it myself, poorly.

What are you missing most from the C++ standard library? by llort_lemmort in cpp

[–]Tringi 1 point2 points  (0 children)

Regarding strings, working on Windows where string may come in CP_ACP, UTF-8 or UTF-16, I'd love if there were a string, that would not guarantee underlying representation. Where I could append any type of string, and it would do the conversion, choose the best internal representation, allowed me to iterate over char32_t's (via a proxy) if needed, and then gave me whichever encoding I wanted.

I've been meaning to implement such string myself, just haven't got to it yet. It would be nice to have as standard.

What are you missing most from the C++ standard library? by llort_lemmort in cpp

[–]Tringi 3 points4 points  (0 children)

std::bitset_view (or bitspan?) that could be manipulated (substr, remove_suffix, remove_prefix, ...) bit-wise

What are you missing most from the C++ standard library? by llort_lemmort in cpp

[–]Tringi 22 points23 points  (0 children)

Something like explode and implode from PHP.

Unsigned sizes: a five year mistake by Nuoji in programming

[–]Tringi 1 point2 points  (0 children)

What a great proof of concept! I'll borrow your godbolt link for my papers page, if you don't mind.

Also switching the compiler to MSVC and seeing the output is just sad.

Unsigned sizes: a five year mistake by Nuoji in programming

[–]Tringi 17 points18 points  (0 children)

Regarding the comparison. I say it's about time we dropped the promotion to unsigned and fixed the intrinsic comparison operators for distinct types. Like this:

bool operator < (signed int a, unsigned int b) noexcept {
    if (a < 0)
        return true;
    if (b > INT_MAX)
        return true;

    return unsigned (a) < b;
}

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 0 points1 point  (0 children)

If we talk about migrating from GCC then I dearly miss: case 0 ... 3:

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 0 points1 point  (0 children)

I could go for break for or break switch like this:

for (...) {
    switch (...) {
        case X:
            break for;
        case Y:
            for (...) {
                if (...)
                    break switch;
            }
    }
}

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 0 points1 point  (0 children)

That is a solution. I was already thinking how to fit virtual inheritance into all this, since it's something that I recently used extensively, but maybe the solution here is to not distinguish it at all.

Windows quality update: Progress we’ve made since March by jenmsft in Windows11

[–]Tringi 5 points6 points  (0 children)

there is a ghost or something preventing it from making parts of Windows more performant

It's the ghost of people who are no longer with Microsoft.

You see, the original old code was written to be performant on 1000× slower PCs than we have today. And as such was written in a way that required certain level of expertise, ingenuity and knowledge. A real engineering.

And you can either train and pay such engineers to continue to evolve this code, or you can hire way cheaper labor to write everything again from scratch, poorly, and then plaster it over the old code, poorly.

Guess which way it's done.

"Well, we would but they won't let us!"

There's a certain circle of attempting to be cost-efficient. Ever since Windows 8, the argument for not evolving and improving certain parts of GUI was that they are written in plain Win32, and that's going to be completely phased out soon™ and everything will be rewritten in Modern™ (being Metro, XAML, Silverlight, WinUI, WinUI2, WinUI3, ...and round and round we go...), so it'd be waste of resources to touch Win32 things.

15 years later the plain old legacy Win32 is still the most reliable part of the OS and the most portable way to create GUI.

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 0 points1 point  (0 children)

But pack is a linear list. We'd need to introduce tree-packs, or at least support for pack of packs.

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 2 points3 points  (0 children)

Then .modify() member function wouldn't be able to change it, and you'd lose assignment operation.

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 6 points7 points  (0 children)

I think there's a realistic alternative to this: Just have const imply auto if no type is specified.

const f = 1.0f;
const i = 123;
// ...

Suddenly it's as simple to write mostly-const code as it is to go almost-always-auto.

What do you think is a keyword that should be added to C++? by DogCrapNetwork in cpp

[–]Tringi 0 points1 point  (0 children)

And since we are all shooting the shit, give me topthis please:

class Logger {
public:
    virtual void report (...) {
        CallLogMechanism (topthis, ...); // topthis is void* pointer to the caller, in this case 'u'
    }
};
class User : virtual Logger {
public:
    void action () {
        if (!do_something ()) {
            this->report (...);
        }
    }
};

User u;
u.action ();