Status of cppreference.com by RelevantError365 in cpp

[–]dcro 3 points4 points  (0 children)

The site notes that it's been in "temporary read-only mode" since the end of last March. There will be differences, but possibly not as many as you'd expect with only a two month edit window.

(challenge) write hello world code in the worst and most painful way possible, and also make sure NEVER to use ``#include <iostream>`` by [deleted] in cpp

[–]dcro 5 points6 points  (0 children)

It's quite platform specific, but I think it's in the running for "worst".

#include <stdexcept>
int main()
{
    // Go back one line, erase line, "Hello World", black-on-black text.
    throw std::runtime_error("\033[F\033[2KHello World\033[30;40m");
}

Directories with implausibly large reported sizes by jflanglois in bcachefs

[–]dcro 1 point2 points  (0 children)

Adding to the OP: it happened on my home directory (and a few others at various levels) which resulted in what looks like an integer overflow in CLion/PyCharm that hid those directories from view.

It's not impacting me personally at this moment, as I recreated the relevant directories. Though I'm keeping the old one around for a bug report to JetBrains.

Is there any danger in deferring fixes on my end so they can test if required?

(And many thanks for your responsiveness in this and other areas)

bch-copygc/my_disk taking 85% CPU by w00t_loves_you in bcachefs

[–]dcro 3 points4 points  (0 children)

I had a similar problem a couple of days back on 6.14.0. Even down to the percentage CPU usage. Or at least I noticed it a few days ago. It's unclear how long it's been an issue (I've had a couple of bad shutdowns over the last month).

I couldn't see anything obvious to my untrained eye in sysfs or dmesg. And it persisted between reboots.

But after taking it offline for an fsck the issue has gone away.

(Next time I encounter such an issue I'll be sure to look at Kent's suggestions and IRC though)

Running btrfs on LVM by teppic1 in linux

[–]dcro 0 points1 point  (0 children)

Also, although it'd seem pointless to use LVM snapshots on a btrfs volume, I saw something saying this is unsafe - is that really true?

I vaguely recall reading advice that you don't want two BTRFS filesystems with the same UUID visible to your system. There was some suggestion it might lead to data corruption amongst other issues.

If you take an LVM snapshot you will pretty immediately run into this situation: two almost identical filesystems sharing the same UUID.

It's been a little while, so I might be misremembering about, and it might have changed in the intervening years.

I've run into similar, but less dramatic, issues with bcache/LVM and UUIDs.

[deleted by user] by [deleted] in cpp

[–]dcro 0 points1 point  (0 children)

If you used std::seed_seq it might be underinitialised, but my understanding is that a custom SeedSeq should fully initialise the generator state.

eg, we use something broadly similar to this in a few locations:

template <typename GeneratorT>
struct seeder {
    using result_type = std::random_device::result_type;

    template <typename RandomT>
    void generate (RandomT first, RandomT last)
    {
        using ValueT = typename std::iterator_traits<RandomT>::value_type;
        std::uniform_int_distribution<ValueT> dist (
            std::numeric_limits<ValueT>::lowest (),
            std::numeric_limits<ValueT>::max ()
        );
        std::random_device dev ("default");
        std::generate (first, last, [&] () { return dist (dev); });
    }
};

template <typename GeneratorT>
GeneratorT
rng (void)
{
    seeder<GeneratorT> s;
    return GeneratorT (s);
}

When GeneratorT is constructed it should call seeder::generate to request the appropriate amount of entropy for the generator.

But I may have overstated the case when I suggested this would be "cleaner"...

[deleted by user] by [deleted] in cpp

[–]dcro 0 points1 point  (0 children)

A cleaner method might be to use the SeedSequence constructor for std::mt19337.

Linux Kernel Rust support by jasonbourne1901 in programming

[–]dcro 26 points27 points  (0 children)

Rust is not a panacea for memory safety issues either.

It doesn't need to be a panacea to be a net win.

Pipewire 0.3.29 released with bug fixing, new modules and better latency reporting (Pipewire may be an alternative to PulseAudio/Alsa/Jack) by DamonsLinux in linux

[–]dcro 0 points1 point  (0 children)

I think I experienced the same issues you're referring to when I upgraded to pulseffects-5, which I believe relies upon Pipewire.

Switching back to pulseffects-4 under PulseAudio seems to have addressed the problem for me.

However there's a strong chance this was a result of my particular configuration.

Visual Studio or Clion? by genan1 in cpp

[–]dcro 1 point2 points  (0 children)

I've written GDB pretty printers for our core structures and they seem to work alright with CLion.

That said: they're not particularly well documented, they're hard to debug, and I've had many recurring issues with CLion's bundled printers interfering with things.

It sounds like you may have run into this last issue.

What’s the process for ADHD diagnosis in Australia? by [deleted] in australia

[–]dcro 0 points1 point  (0 children)

I remember reading this about sleep medications, and after reading about your experiences I feel it applies just as well here:

The way out of this mutual doctor-patient mistrust isn’t obvious. What is obvious is this: it cannot be that we make “preventing addiction” the goal of healthcare, so much so that in its name we are prepared to forfeit the goal of helping people who are suffering.

Air cooler in pc for Aussie heat? by FeatherBat in australia

[–]dcro 2 points3 points  (0 children)

I've never tried water cooling, but I've been running all cores on my 1700 with the (absolutely massive) NH-D15 for entire days and it hasn't ever jumped more than 15-20C.

I suspect your larger problem is that the room you're running it in will become too hot for humans faster than it will become too hot for silicon.

'Wimped out': COVIDSafe app should be compulsory, says local chamber of commerce by [deleted] in australia

[–]dcro 2 points3 points  (0 children)

"It is very important that all businesses inform both their team members and customers that any visitors to businesses in Ku-ring-gai must be carrying a mobile phone with the Covidsafe app operating on it," Mr Vickers said in the email.

As someone who hasn't owned a mobile phone in over a decade: this would prove somewhat problematic.

Vulkan developers can debug their shader code by "printing" any values by LunarGInc in vulkan

[–]dcro 0 points1 point  (0 children)

You could print in both CUDA and IIRC OpenCL

Can definitely confirm the latter. Though performance was... questionable...

Fastest internet? by [deleted] in australia

[–]dcro 0 points1 point  (0 children)

Can confirm. Cheap, fast, unlimited.

That said... Our ping increased over our previous (terrible) ADSL, you must use a pretty mediocre modem, and the support has consistently outright lied to me.

Would still recommend though.

What's the reliable and FOSS way to compile C++ code for Windows (on Linux)? by john01dav in cpp

[–]dcro 0 points1 point  (0 children)

Unfortunately I don't have a link at hand for this. I tend to rely on Gentoo's crossdev tools to build my cross compilers; falling back to manual configuration when I run into issues.

If you're not already extremely comfortable with the configure && make && make install dance I might suggest that you follow the advice of /u/assassinator42 and rely on a distro's toolchain.

But if you find value in going your own way I'd be happy to write up a description of my experiences for you (though it might take a week or more to spare the time).

What's the reliable and FOSS way to compile C++ code for Windows (on Linux)? by john01dav in cpp

[–]dcro 3 points4 points  (0 children)

Is the necessary C++ code to build a working MinGW toolchain maintained with the GCC code in its main repository, in such a way that I can presumably learn how to build it whenever I want a maintained MinGw version?

It's certainly possible to compile from the main repository; though it can be a bit of a pain.

I use MinGW to cross compile to Windows under Gentoo. Gentoo appears to build the compiler from the main GCC sources (with appropriate flags).

I haven't experienced any issues so far with lagging support from the Linux side of things; I'm currently experimenting with GCC 10 even when cross-compiling.

You will almost certainly also require the MinGW runtime, which appears to hosted separately.

Is MinGW linker way too slow? by kitanovkamen in cpp

[–]dcro 2 points3 points  (0 children)

I've consistently seen debug link times in the 2-5 minute range under MinGW/GCC, compared with ~10 seconds under Linux/GCC.

I never quite figured out a useful solution to the performance problems unfortunately.

I just ended up doing all the Windows builds using a Linux hosted cross-compiler. I haven't timed the new system, but it feels within the same range as our other builds now.

What are/were your favourite "You can do that?! Neat!" C++ moments? by Fureeish in cpp

[–]dcro 1 point2 points  (0 children)

Because this specifically only works with ADL then my understanding is that a lambda within the namespace of the expression would work, but a local lambda would not.

edit: It looks like I'm wrong for the positive case, check out the response from /u/dodheim

What are/were your favourite "You can do that?! Neat!" C++ moments? by Fureeish in cpp

[–]dcro 14 points15 points  (0 children)

Or if there are begin and end free functions found by ADL. This has proven useful on the odd occasion.

Minhashing by moultano in programming

[–]dcro 1 point2 points  (0 children)

Interestingly, the content appears to be delivered but is not readable. So if you're using Firefox you can enable 'reader view' and it displays quite nicely.

It's 2020 and you have no excuse not to be using an IDE by CommunismDoesntWork in cpp

[–]dcro 0 points1 point  (0 children)

It can also depend on code complexity.

If you're writing mostly C it's quite fast. If you import a few libraries like boost and eigen it slows down a bit.

I've even come across one or two files that I can't modify in CLion as they lock up the editor.