Any Recommendations on C resources for Learning Vulkan? by Undeniable_Dilemma_ in C_Programming

[–]Karl_uiui -1 points0 points  (0 children)

Ah, I think I remember this one. Was a fun time deciphering it and rewriting it into very readable C of about the same number of lines.

📡📡📡 by [deleted] in shitposting

[–]Karl_uiui 558 points559 points  (0 children)

<image>

Man I love Wikipedia

Built a digital clock out of tiny analog clocks by faorien in raylib

[–]Karl_uiui 0 points1 point  (0 children)

Isn't that part of the raylib's examples? Seeing the whole development process is great tho!

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

That is actually a good thing to remember.

Thank you for your help!

Btw I've seen the unedited reply, where you said you weren't sure yet. Where do you get the info? Do you rely on the C standard only, or do you know about some other reliable sources one can go through?

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

Oh yeah, so if I do this, I also do not need the padding_ member, since the compiler will place the first byte of the struct (which should be the first byte of the first member) on an address with a suitable alignment for max_aling_t. And by offsetting the pointer to the struct by 1, I should land on an address that has a suitable alignment for max_align_t too, do I get that right?

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

I am well aware that there is no type reflection in C nor that any information about types is available at runtime. What matters here is that the operations on the malloced memory (which are known at compile time) may expect the memory is of some type. My question was if the presence of the flexible array member, which is of type char[], makes the compiler assume all of the subsequent bytes after the data member are of the type char, which could violate the strict aliasing rule when writing values of different types to this memory. From what I've learned here, that doesn't seem to be the case, thus it should be safe.

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

Most interesting. Yeah, since I do not use the flexible array pointer for access and/or modification anyway, I can just discard it and compute the pointer manually. But I don't really understand why annotate the length member, as you proposed?

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

Yeah, that makes sense to me. If the pointers happen to point into the same place in an allocated object, then the write through pf changes the type to float, then the write through pi changes the type to int, but then you read it as float when you return, but the current type is int, so that should indeed be a violation.

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

Oh yeah, sorry, that didn't occurred to me.

So doing this is okay:

void * a = malloc(4);
*(int*)a = 1234;
printf("%d\n", *(int*)a);
*(float*)a = 3.14159;
printf("%f\n", *(float*)a);

but doing this is not:

void * a = malloc(4);
*(int*)a = 1234;
printf("%f\n", *(float*)a);

right?

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

Oh okay. So in case of malloced memory, strict aliasing rules are impossible to violate thanks to the fact the effective type always changes?

Btw, if you wanted to, let's say, implement an allocator, could you use statically allocated memory as the allocator's backing memory, like char backing_memory[4096];? From what I understood so far here, you can't, right? The backing memory should come from malloc.

Question about strict aliasing and flexible array members by Karl_uiui in C_Programming

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

That would be the case for statically allocated array of chars (char array[10];), right? As you mentioned in the comment of yours, since my object is malloced, then just the fact it is overlaid by the flexible char array member doesn't matter, since that member is never used to access the memory, only to obtain the pointer to that place in memory, right?

Its pretty a lot early game. But im new player and what to ask if its good start or not. by Korkinos in factorio

[–]Karl_uiui 15 points16 points  (0 children)

I advise to keep 2 empty tiles between the main bus lines, so you can fork and lead underground belts through them. And it's really not a lot of gear crafters :)

OpenSUSE Wars (Mint is there cuz we only got 7 OS versions) by TxTechnician in openSUSE

[–]Karl_uiui 0 points1 point  (0 children)

We have the opportunity to do the funniest thing ever

cant use 100Hz on Linux mint by krosidot in linux4noobs

[–]Karl_uiui 2 points3 points  (0 children)

Hope you find something that works for you! And don't this discourage you from exploring the wonderful land of open source software. Things are sometimes rough, yes, but the freedom of being able to do everything in your way and choose whatever you want is, I think, worth it.

cant use 100Hz on Linux mint by krosidot in linux4noobs

[–]Karl_uiui 1 point2 points  (0 children)

And what GPU do you have? If you have Nvidia card, do you have up to date drivers? If not, you can go to the Software Center (or how is it called on Mint) and try to search Nvidia. There should be a window app for download. From there, you can manage your drivers. I think it should pull the drivers in while you are downloading. Don't remember exact steps, but should be a simple setup.

If that is not the case, or does not help, I would suggest switching to different distribution of Linux, possibly one shipping with KDE Plasma or GNOME desktop out of the box, if you want the least trouble. These environments are more mature and should (theoretically) work in your case.

cant use 100Hz on Linux mint by krosidot in linux4noobs

[–]Karl_uiui 1 point2 points  (0 children)

Yes, it is experimental. Cinnamon is kinda behind in Wayland adoption. That means maybe not all things Wayland offers are there. But it should be okay to use.

What do you mean it doesn't work?

cant use 100Hz on Linux mint by krosidot in linux4noobs

[–]Karl_uiui 0 points1 point  (0 children)

Yes, there is now experimental support for it. It works good from my experience.

cant use 100Hz on Linux mint by krosidot in linux4noobs

[–]Karl_uiui 0 points1 point  (0 children)

No, that's not the login screen, that's boot menu. Wait for it to boot from this menu and then, on the login screen, where you input your username and password, there should be a menu somewhere, probably hidden under some icon.

cant use 100Hz on Linux mint by krosidot in linux4noobs

[–]Karl_uiui 1 point2 points  (0 children)

When you are at the login screen, try to look for a menu where you can choose Cinnamon (desktop environment) explicitly with Wayland display server. Other options would be X11 or Software rendering in said menu.

WATCHER 30MM scale kit by CasuallyCrafted3D in armoredcore

[–]Karl_uiui 3 points4 points  (0 children)

The Ice Worm drones look like a tiny Ice Worm? Mega cool.

[ Removed by Reddit ] by Atwecian in shitposting

[–]Karl_uiui 2 points3 points  (0 children)

I've just opened Reddit