Anton Lobashev

6 Followers
122 Following
92 Posts
Still trying to find my place in this mad world.
Not actually a game dev, more like a games-adjacent tools developer.
Githubhttps://github.com/soulthreads

Hey Fediverse! I'm looking for a new job.

I'm a C++ developer with 11 years of experience, mostly focused on desktop apps (Qt, Gtk, Dear ImGui, you name it) and graphics-related tooling, but I've also had a short stint (3y) of working with IoT and Go, and I can write Python to hold it all together.

I'm looking for worldwide remote work opportunities (& my "business" is located in Armenia, if that matters)

#GetFediHired #fedihire

Subscribing to BloomScrolling hashtag has meaningfully and significantly improved my morning phone "routine". Would definitely recommend.

Now I even feel like I need to replace my default feed with just that kind of stuff (+ mosstodon) and chuck the default feed somewhere far away...

I've decided to start a blog. The first post is super messy and rambly, but here's a quote:

"technology for its own sake without considerations about its impacts on human connectedness is a mistake. As we say in our language, if you see people advocating for that, drive them out with pissed-through rags and laugh at them."

On having connection to real people, p.1: https://lobashev.me/blog/2026-03-06-connection.html

A trend I've noticed here in a local food delivery service is, using AI-generated pictures for items. Makes me instantly skip the restaurant:
1) I have no idea how the food actually looks and what it consists of
2) it immediately sets off an alarm that they are trying to hide something, and it breaks any sense of trust.

I'm probably not the only one, and I'm not sure they are aware of what they are doing.
Even a shitty phone picture of the dish in the delivery container would've been better.

Defer available in gcc and clang

About a year ago I posted about defer and that it would be available for everyone using gcc and/or clang soon. So it is probably time for an update.

Two things have happened in the mean time:

  • A technical specification (TS 25755) edited by JeanHeyd Meneide is now complete and moves through ISO’s complicated publication procedures.
  • Both gcc and clang communities have worked on integrating this feature into their C implementations.

I have not yet got my hands on the gcc implementation (but this is also less urgent, see below), but I have been able to use clang’s which is available starting with clang-22.

I think that with this in mind everybody developing in C could and should now seriously consider switching to defer for their cleanup handling:

  • no more resource leakage or blocked mutexes on rarely used code paths,
  • no more spaghetti code just to cover all possibilities for preliminary exits from functions.

I am not sure if the compiler people are also planning back ports of these features, but with some simple work around and slightly reduced grammar for the defer feature this works for me from gcc-9 onward and for clang-22 onward:

#if __has_include(<stddefer.h>) # include <stddefer.h> # if defined(__clang__) # if __is_identifier(_Defer) # error "clang may need the option -fdefer-ts for the _Defer feature" # endif # endif #elif __GNUC__ > 8 # define defer _Defer # define _Defer _Defer_A(__COUNTER__) # define _Defer_A(N) _Defer_B(N) # define _Defer_B(N) _Defer_C(_Defer_func_ ## N, _Defer_var_ ## N) # define _Defer_C(F, V) \ auto void F(int*); \ __attribute__((__cleanup__(F), __deprecated__, __unused__)) \ int V; \ __attribute__((__always_inline__, __deprecated__, __unused__)) \ inline auto void F(__attribute__((__unused__)) int*V) #else # error "The _Defer feature seems not available" #endif

So this is already a large panel of compilers. Obviously it depends on your admissible compile platforms whether or not these are sufficient for you. In any case, with these you may compile for a very wide set of installs since defer does not need any specific software infrastructure or library once the code is compiled.

As already discussed many times, the gcc fallback uses the so-called “nested function” feature which is always subject of intense debate and even flame wars. Don’t worry, the implementation as presented here, even when compiled with no optimization at all, does not produce any hidden function in the executable, and in particular there is no “trampoline” or whatever that would put your execution at risk of a stack exploit.

You may also notice that there is no fallback for older clang version. This is because their so-called “blocks” extension cannot easily be used as a drop-in to replace nested function: their semantics to access variables from the surrounding scope are different and not compatible with the defer feature as defined by TS 25755.

So for example if you are scared of using big VLA on the stack, you may use the above code in headers and something like

double* BigArray = malloc(sizeof(double[aLot])); if (!BigArray { exit(EXIT_FALURE); } defer { free(BigArray); }

to have an implementation of a big array with a failure mode for the allocation.

Or if you want to be sure that all your mutexes are unlocked when you leave a critical section, use and idiom as here

{ if (mtx_lock(&mtx) != thrd_success) { exit(EXIT_FAILURE); } defer { mtx_unlock(&mtx); } ... do something complicated ... if (rareCondition) { return 42; } ... do something even more complicated ... }

Just notice, that you’d always have to use the defer feature with curly braces to ensure that the gcc fallback works smoothly.

Simple defer, ready to use

With this post I will concentrate on the here and now: how to use C’s future lifesaving defer feature with existing tools and compilers.

Jens Gustedt's Blog

In this modern era of acquisitions, weak antitrust regulations, and platform capitalism leading to extreme concentrations of wealth, non-profits remain a bastion defending what remains of the commons.

https://ziglang.org/news/migrating-from-github-to-codeberg/

Migrating from GitHub to Codeberg ⚡ Zig Programming Language

Just watched a video about IKEA using 3D renders for everything: https://www.youtube.com/watch?v=Kup0d4Te3n0

And then noticed some _really_ familiar controls.
@ocornut you are probably already aware of this, but once again, congrats on building such a versatile and useful tool!

IKEA's Journey Through 3D Visualization and Spatial Computing By Martin Enthed

YouTube
0.12.0 Release Notes ⚡ The Zig Programming Language

The ones I found publicly were seemingly okay but if you stared into the matrices and formulas long enough, you'd see a bunch of errors sprinkled here and there.

That, combined with (I think?) different matrix column-row order in HLSL vs. GLSL, resulted in some fun debugging hours.
In the end I just went with what the "official" Oklab page says, plus adding check for division by 0 for atan2 call.

I'm left wondering, do people actually test it before publishing that stuff online?

(2/2)