@mort@fosstodon.org avatar

mort

@mort@fosstodon.org

Programmer, mostly writing C++, C and Go.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

mort, (edited ) to cpp
@mort@fosstodon.org avatar

Hot C++ take: moved-from standard containers should be specified to work "as if newly default-constructed", not "in a valid but unspecified state"

Alternatively, we should embrace the unsafety and say that moved-from containers are in an "invalid state where the only safe operation is calling the destructor"

As it is, we get the (potential/small) overhead of making sure the container is in a valid state but not the convenience benefits of knowing what that state is

#cpp #programming

mort,
@mort@fosstodon.org avatar

@numeredevs It's not just about temporaries. The std::move function is a cast from lvalue ref to rvalue ref. So this code will move 'foo':

std::vector<int> foo;
std::vector<int> bar = std::move(foo);

The second line calls the std::vector&lt;int&gt;::vector(std::vector&lt;int&gt; &amp;&amp;) ctor.

After the move, 'foo' is moved from, which means it's "in a valid but unspecified state".

n3wjack, (edited ) to random
@n3wjack@mastodon.social avatar

This has probably been done before, but I'm still curious how the OS spread is on the fedi.

What are you running on your main* personal desktop/laptop?

Boost for reach please! ๐Ÿ˜

  • The machine you use the most. ๐Ÿ˜‰
mort,
@mort@fosstodon.org avatar

@n3wjack Desktop is Linux all the time, but on my laptop, I quite actively switch between Linux and macOS...

I would honestly probably be on Linux most of the time on my laptop if only Linux didn't consume sooo much power during sleep on these Apple Silicon machines

mort, to vscode
@mort@fosstodon.org avatar

I will never understand why #vscode defaults to not adding a newline at the end of the file

At least in UNIX-like systems, line feeds are line terminators. Many tools expect there to be a newline after the last line. Most text editors include a newline at the end of the file. VSCode's strange default causes lots of projects to end up with files without a final newline, and causes git churn where people add and remove trailing newlines. #microsoft #programming

mort, to random
@mort@fosstodon.org avatar

USB-C is so cool, I get to spend time debugging why display out sometimes isn't working through this dock instead of doing boring things like getting work done

I think the order I have to do things is: 1) turn off the screen and unplug the dock, 2) plug in the dock, 3) turn on the screen

If I do things in any other order, or the laptop goes to sleep, the screen turns solid grey, and this state persists across laptop restarts and screen power cycling and dock disconnecting + reconnecting etc

mort, to music
@mort@fosstodon.org avatar

It's not much, but I did a little #music today. I wanted to try out making music with the TR-808 drum machine sound, since I've always used more realistic-sounding drum samples. #lmms

mort,
@mort@fosstodon.org avatar

Wow Mastodon's web interface's audio visualizer is actually really cool

mort, to web
@mort@fosstodon.org avatar

Weird that #curl doesn't have an option for just sending arbitrary binary post data... even with --data-binary, curl adds a Content-Type: application/x-www-form-urlencoded header. This tripped me up just now, as this server I'm working against handles URL-encoded requests very differently from non-URL-encoded requests.

You can add -H 'Content-Type:' to remove the header, but it's weird that curl just adds that header even when it has no reason to think the payload is URL-encoded... #web

mort,
@mort@fosstodon.org avatar

@bagder Yeah, I've used curl for many years to POST data to servers and it hasn't been an issue. However, this time I was making a server using a web server library which automatically parses the body itself instead of running my body handler callback if the Content-Type is application/x-www-urlencoded >_>

Took a while to debug, I was certain I'd used the library wrong. I hadn't imagined that curl would send a bogus Content-Type (nor did I expect the library to ignore my callback to be fair)

mort, to programming
@mort@fosstodon.org avatar

Does anyone know if there's a common notation for fixed-point? Like how we say u32 for 32-bit unsigned int and i64 for 64-bit signed int

If not, I propose that we use the notation u24.8 for unsigned fixed-point with 24 bits before the point and 8 bits after

#programming #c

mort,
@mort@fosstodon.org avatar

@kinnison Oh neat, that's apparently called Q notation: https://en.wikipedia.org/wiki/Q_(number_format)

kate, to random
@kate@fosstodon.org avatar

deleted_by_author

  • Loading...
  • mort,
    @mort@fosstodon.org avatar

    @kate All valid points, but the thing that hit me first is: does "CO2 per 1kg of material" even make sense as a metric? If bricks use 2x the CO2 per kg compared to concrete, but a house built out of concrete is 2x as heavy as a house built out of bricks, the total CO2 is the same between them right

    Also the widths of the samples differ, which doesn't convey information but makes an intuitive difference, the stone sample looks tiny but it's almost as tall as the concrete sample

    kate, to random
    @kate@fosstodon.org avatar

    deleted_by_author

  • Loading...
  • mort,
    @mort@fosstodon.org avatar

    @kate Aw I missed you by only half a square on the X axis

    drewdevault, to random
    @drewdevault@fosstodon.org avatar

    Just factory reset an old Android phone and FUCK mainstream Android has a lot of bullshit

    mort,
    @mort@fosstodon.org avatar

    @drewdevault This is me!

    I wouldn't mind using an Android phone with AOSP and no proprietary Google services, but that doesn't really seem to be possible, especially if I want things like banking apps

    Sooo... I use the one alternative that exists

    mort, to Signal
    @mort@fosstodon.org avatar

    I don't want to give #signal access to my contacts, yet every time it asks me I can say "yes" or "not now" and if I click "not now" it just says "we'll remind you later"

    How about you just respect my desire to not share my contacts instead hmm

    mort,
    @mort@fosstodon.org avatar

    Honestly, the whole modern trend of chat apps telling you once a contact has made an account is super creepy... so many "this person you met once 15 years ago has made an account". Why should I know that? ... why should they know that I made an account?

    Or better yet "this person who you have cut out of your life and who you don't want to have a way to contact you has made an account". They even appear in your list of active chats and I don't want that #signal #telegram

    mort,
    @mort@fosstodon.org avatar

    @X_Raph_X No. If that person tries to contact me, I need to know.

    Signal and Telegram shouldn't try to, and doesn't get to, dictate how I can and can't use my personal contacts list. <edited to be less aggressive>

    mort,
    @mort@fosstodon.org avatar

    @X_Raph_X You're right, my response was too aggressive towards you. I reacted emotionally because the thought of now having this person in my contacts (so that I can know and report it if they try to call or send SMS) is scary to me. I apologize.

    mort,
    @mort@fosstodon.org avatar

    I'm not sure how that's supposed to help, I don't want to give Signal my contacts, I don't want Signal to tell me any time someone I once met joins signal, and I don't want Signal to tell people I met 15 years ago that I'm on Signal

    mort,
    @mort@fosstodon.org avatar

    @tehabe "People who have my phone number in their contact list" is who I'm talking about when I say "people I met 15 years ago"

    mort,
    @mort@fosstodon.org avatar

    @tehabe Which makes it worse; joining Signal will randomly notify some large but unknown number of people, most of whom you don't know (at least not anymore), that you just joined Signal

    eniko, to random
    @eniko@peoplemaking.games avatar

    you know what? the supermassive caves in minecraft's caves and cliffs update suck

    like yeah they're aesthetically compelling, assuming you can figure out how to light em all up, but the fact that they're literally everywhere makes them boring really quickly since they're not at all special

    and they suck for gameplay. the whole process of caving just becomes pillaring up or towards or digging down to a huge mob infested plateau, spamming torches to light it up, and then having to pillar up a dozen times to get high spots

    the whole thing is just way less engaging than caving was before where cramped tunnels created tense situations and the huge caves basically add to the overworld the kind of annoying ass traversal people have always hated the nether for

    increasingly minecraft seems to my game designer brain like a series of bad game design decisions propped up by an extremely engaging core mechanic

    mort,
    @mort@fosstodon.org avatar

    @eniko So right before you started talking about Minecraft I started playing slightly-modded survival on 1.20 (I installed the create mod and computercraft but it's not one of those mod packs with 1000 bajillion mods) and

    I agree so much, I encounter those gigantic caves all the time and they're just kinda big mob spawning rooms but not in an interesting way

    World gen hasn't ever been as good as it was back in alpha imo, there were some wild and beautiful and insane terrains back then!

    eniko, to random
    @eniko@peoplemaking.games avatar

    today in minecraft i get to go do some actual mining since i'm fresh outta diamonds and even lapis, and i'm so happy because at least it's not the fucking nether

    in other news, twice now i've had to extract a villager who managed to make their way through my nether transport tunnels and decided to make a new life for themselves in my base >:|

    mort,
    @mort@fosstodon.org avatar

    @gaycodegal @eniko I was playing the phone edition lately (until an update broke it) and it made me realize just how much enjoyment of Minecraft depends on the f3 debug menu, which the phone version seems to lack

    When enjoyment of your game depends on info provided by a developer debug menu, you've failed as a game designer IMO. If info about what chunk you're in is important (which it is), tell them, through the environment (different block types or cave types?) or at least some item!

    eniko, to random
    @eniko@peoplemaking.games avatar

    "we need this effect to update at roughly 60hz" is a remarkably intractable problem

    unless you just brute force it by checking if the current fps is under 110, in which case you just do it every frame, or every other frame if over 110, or using a 1/60th timestep if over 170 >_>

    yay dirty hacks. but it works better than the "proper" way

    mort,
    @mort@fosstodon.org avatar

    @eniko By far the easiest solution is to just decode video frames according to a separate clock and just draw whatever happens to be the latest frame whenever the process happens to re-draw, just like how the easiest way to "update the effect at roughly 60Hz" is to not care about frames and just subtract the delta-time from a counter and do while (counter &lt;= 0) { effect.step(); counter += 1/60; }. But obviously that solution is terrible and the resulting hitching is sooooo unsatisfying ๐Ÿคฎ

    mort,
    @mort@fosstodon.org avatar

    @eniko Totally sensible

    ... but also VRR is a thing now and people with VRR very often play in the range of 76-110Hz >_>

  • All
  • Subscribed
  • Moderated
  • Favorites
  • โ€ข
  • anitta
  • InstantRegret
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • JUstTest
  • tacticalgear
  • ethstaker
  • provamag3
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • modclub
  • megavids
  • normalnudes
  • Leos
  • lostlight
  • All magazines