• 7 Posts
  • 348 Comments
Joined 2 years ago
cake
Cake day: June 18th, 2023

help-circle

  • Similarly, what would you gain by saying uint32_t const* x = my_var.get<uint32_t>();

    To be frank: You gain the information that MyConcreteType::get<uint32_t> returns a uint32_t, which I otherwise couldn’t infer from the docs. Of course, I could assume it, based on the template parameter, but I don’t want to go around assuming a bunch of stuff in order to read docs.

    Take an example like auto x = my_var.to_reduced_form(), it’s very clear that x is the “reduced form” of my_var, which could be meaningful in itself, but what type is it? I need to know that if I want to do anything with x. Can I do x += 1? If I do, will that modify my_var? Let’s say I want to make a vector of whatever to_reduced_form returns… and so on.

    All these questions are very easily answered by MyConcreteType x = my_var.to_reduced_form(). Now I immediately know that everything I can do with my_var, I can also do with x. This makes me happy, because I need to do less digging, and the code becomes clearer to read.


  • Thanks, that was a good read :)

    However, my impression is that he’s largely using the existence of templates and polymorphism as arguments that “we don’t really care about type”. I disagree: A template is essentially a generic type description that says something about what types are acceptable. When working with something polymorphic, I’ll prefer ParentClass&, to indicate what kind of interface I’m working with.

    Sure, it can be very useful to hide exact type information in order to generalise the code, but I think that’s a weak argument for hiding all type information by default, which is what auto does.


  • I really like C++ (I know, shoot me), and I think auto should be avoided at (almost) all costs.

    One of the things I love about a language like C++ is that I can take one glance at the code and immediately know what types I’m working with. auto takes that away while adding almost no benefit outside of a little convenience while writing.

    If I’m working with some very big template type that I don’t want to write out, 99/100 times I’ll just have a using somewhere to make it more concise. Hell, I’ll have using vectord = std::vector<double> if I’m using a lot of them, because I think it makes the code more readable. Just don’t throw auto at me.

    Of course, the worst thing ever (which I’ve seen far too often) is the use of auto in examples in documentation. Fucking hell! I’m reading the docs because I don’t know the library well! When you first bother to write examples, at least let me know the return type without needing to dig through your source code!



  • It’s not a war crime to shoot an enemy after they mistake you for their own. That’s on them.

    It would be a war crime if he feigned surrender (in which case they would have taken his weapon) or injury (which he clearly wasn’t), or was wearing insignia indicating that he was russian (which we cannot conclude from this video). Regarding the last point, it seems highly unlikely that a single Ukraine soldier would be sent alone behind enemy lines with russian insignia in the hope that something like this would happen.

    There was a report on this: Appears the guy was part of an assault and lost contact with his unit. These russians messed up bad (the Ukrainian was likely fluent in russian) and got killed for it. That’s what happens in war. When you mess up, you’re liable to get killed for it. There’s no law of warfare preventing the enemy for exploiting your mistakes.




  • That completely depends on what you’re doing. If you’re doing tasks that python can completely offload to some highly optimised library written in C/C++/Fortran, then yes. However at that point you’re not really comparing Python to C anymore, but rather your C implementation to whatever library you used.

    A fair comparison is to compare pure python to pure C, in which case you need to mess up the C-code pretty bad if Python is to stand a chance.


  • thebestaquaman@lemmy.worldtoxkcd@lemmy.worldxkcd #3124: Grounded
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    1 month ago

    Do you have a source for this? My only reference here is hiking at > 10 000 ft (3000 m), and from that I can say that this seems very unlikely: If you stay at 3000 for a couple hours without acclimating first, you will definitely start to feel the effects. To be fair, you’re usually not moving around a lot in an aircraft, but a couple hours at 3000 m can make you feel sluggish and weak, and even a bit light-headed, you could even get a mild headache from oxygen deprivation.

    Note that not everyone will see severe symptoms already at 3000 m. Plenty of people can go to 4000 m before seeing significant symptoms. However, given that I’ve never heard of anyone experiencing altitude sickness in a properly pressurised aircraft, it seems unlikely to me that they’re pressurised to 3000 m.


  • I agree with the sentiment that this isn’t directly bad as long as they’re fighting the russians. However, if their motivation to fight is just to learn how to use UAV’s for a cartel, they’re likely to desert at the moment shit hits the fan. This hurts morale badly.

    Secondly, the countries in which the cartels operate will be more inclined to actively take Ukraines side if they take this seriously.

    Finally,

    You can’t prosecute ppl for crimes they did not yet commit.

    To be frank: Yes you can (in a sense). Planning a crime (robbery, murder, etc.) can often be prosecuted as a crime in itself, often under the condition that the person in question appears capable or near-capable of doing whatever they were planning to do.