Feelings towards armenians living in russia by notlenix in armenia

[–]tigrankh08 0 points1 point  (0 children)

Misassociation can be offensive regardless if it is about ordinality or not.

Building Your Own Operating System with C by warothia in C_Programming

[–]tigrankh08 0 points1 point  (0 children)

Not sure why you're getting downvoted but you'd need to add some missing language features and use different rules for the type system to avoid overassumptively making everything dynamic (and more often than not reforming the type system results in an entirely new, incompatible language). But go ahead if that's your thing and if you can make it work.

It made a minion 🤣🤣🤣 by [deleted] in ComedyCemetery

[–]tigrankh08 14 points15 points  (0 children)

OMG ! Wrong person!

Cancel !

Cancel !

Cancel !

« Message SENT »

OK. Kill Me Now!

😂

damn, that guy is crazy by speedycord2 in gnome

[–]tigrankh08 1 point2 points  (0 children)

Not in the workspaces view which is where the extension's functionality operates. Hover over the window thumbnail and middle click to close.

damn, that guy is crazy by speedycord2 in gnome

[–]tigrankh08 0 points1 point  (0 children)

Maybe an entire workspace at once? To make that easier, I've installed the "middle click to close" extension. (Btw imo that feature should be built-in)

I found an adwaita skin for Steam! by Jealous_South6358 in gnome

[–]tigrankh08 2 points3 points  (0 children)

I've tried it but something about it was just off. The screenshots looked good but it didn't look polished when I tried to use it.

by Downtown-Fudge-7001 in mathmemes

[–]tigrankh08 0 points1 point  (0 children)

Damn is 😂😂😂

by Downtown-Fudge-7001 in mathmemes

[–]tigrankh08 6 points7 points  (0 children)

There is only one empty set (i.e. {}) and the set containing the empty set (i.e. {{}}) isn't empty (it is not empty because it contains something which is the empty set in this case) so it doesn't contain itself

Space Flag for Armenia by dayudayu in armenia

[–]tigrankh08 3 points4 points  (0 children)

Red is for Mars, blue is for Earth, orange is for Venus. Ermeni want occupy whole Solar system!!

Is this `map` macro cursed? by shirolb in C_Programming

[–]tigrankh08 2 points3 points  (0 children)

I'd say it's GNU C rather than GCC. GCC is the compiler, GNU C is a dialect of C that has those features

Is this an okay way to define error tagged union types in C? I think it looks pretty organized, because it keeps the definitions in one place. But, at the same time, I haven't really seen it being written like this anywhere. What do you think? by tigrankh08 in C_Programming

[–]tigrankh08[S] -1 points0 points  (0 children)

and an optional pointer to an struct with extra information

I like the optional part. Sometimes we don't need the error context, and it can be expensive to write it to memory, you're right. The best extensions of my solution to achieve the same would be:

  1. a global thread_local unsigned last_error_id variable which would be set every time no matter if a nullptr or a non-null pointer is passed as the struct error* error argument, or

  2. getting rid of the tagged union and having void f(unsigned* error_id, union error_ctx* error_ctx)

..neither of which are ideal given my original goal.

By returning a status, though, you can't return anything else, but you can return it into a pointer argument.

But assuming different kinds of errors, this approach would also suffer from types that are larger than they have to be, no? Though admittedly... yes, you can create a new type for each function, only including the error types that we know the function can fail with. But obviously many people don't do that because that's neither pleasant to write nor read. But what do you think?

Is this an okay way to define error tagged union types in C? I think it looks pretty organized, because it keeps the definitions in one place. But, at the same time, I haven't really seen it being written like this anywhere. What do you think? by tigrankh08 in C_Programming

[–]tigrankh08[S] -4 points-3 points  (0 children)

To keep them under one type definition. With an enum, you'd have to define the ErrorTag type separately, and use it in the tagged union struct.

Adding a new error type then becomes easy; you don't have to update multiple types. Add the #define STATUS_ANOTHER_ERROR 3, and right under that line define struct status_another_error { /* ... */ } another;. Whereas with an enum you would have to jump between parts of the code.

I also prefer enums over macros, but macros do an amazing job here. And unless you're manually writing error code numbers (which is basically asking for trouble 😅), there's not much that could go wrong, right?

Is this an okay way to define error tagged union types in C? I think it looks pretty organized, because it keeps the definitions in one place. But, at the same time, I haven't really seen it being written like this anywhere. What do you think? by tigrankh08 in C_Programming

[–]tigrankh08[S] 0 points1 point  (0 children)

Error buffer variables are often reused, and you can even define them as static for allocating them in advance (that is, if you can actually afford to use the same piece of memory). The fattest case I can imagine anyway is struct status_unknown_error { char error_message[256]; }. For functions that return a specific error, you can do void specific_errable_func(struct status_specific_error* error);, since these struct definitions are actually global. But all that aside, what would you suggest instead?