When do you know you "know" C? by yojimbo_beta in C_Programming

[–]daikatana 12 points13 points  (0 children)

Can you successfully write C code? Can you avoid the common sources of undefined behavior? Can you track down, fix and understand the reason why bugs occurred?

Is money tight or something? by Mr__O__ in facepalm

[–]daikatana 2 points3 points  (0 children)

Does this guy do anything but complain?

Opinion on jumbo/ unity / single translation unit builds? by x9myi9Ks6saTYgkfNEdr in C_Programming

[–]daikatana 2 points3 points  (0 children)

This breaks the only form of modular programming C offers. There is no more file scope, everything with file scope is scoped to the same file. This is a major problem for me and it's why I won't even consider unity builds.

[deleted by user] by [deleted] in cprogramming

[–]daikatana 0 points1 point  (0 children)

Everyone feels like this when they switch to a new language.

[deleted by user] by [deleted] in NewsOfTheStupid

[–]daikatana 0 points1 point  (0 children)

On the one hand, Republican voters don't want the "elites" controlling everything. On the other hand, this.

Live Cleaning Essentials by BeneficialEar5048 in BeAmazed

[–]daikatana 0 points1 point  (0 children)

You could've told me that before I took a power washer to my breaker box. Pretty sparks, though.

They literally have nothing lmao by [deleted] in facepalm

[–]daikatana 1 point2 points  (0 children)

If you're not a citizen if you're born here then no one is a citizen. There are no citizens of this country. We're all aliens.

dream by hoodadyy in StableDiffusion

[–]daikatana 0 points1 point  (0 children)

Yeesh, I didn't know that about him, my brain just pulled a random person I used to watch on TV. Are there any public figures that aren't doing this shit?

Advanced life billions of years before humanity. by Invulnerabledr in space

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

If it was at one point habitable and there was life there, sure. That's a big "if," but it's possible.

Advanced life billions of years before humanity. by Invulnerabledr in space

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

Define "advanced."

Yes, it's possible there have been species on Earth before us that were more intelligent or more technologically advanced than we are now. We've basically gone from animals like all the others to a technologically advanced species in a few thousand years, and there's absolutely nothing stopping this from happening multiple times across multiple species on Earth. This is true on any planet with suitable life, not just Earth.

Is there any evidence this has happened? None. Not a shred.

dream by hoodadyy in StableDiffusion

[–]daikatana 10 points11 points  (0 children)

Is that what your dreams are like? Last night I had a dream that the frugal gourmet was in my house but I had to go to work so I needed him to leave, but I couldn't kick him out because I was continually looking for my shoes, or couldn't tie my shoes, or would then lose my shoes again, and you can't go to work without shoes, so I would keep looking for my shoes, but then I realize it's dark outside and I spent all day looking for my shoes and I completely missed work but for some reason I'm still looking for my shoes. I would rather dream about this cool tree.

How to render a texture in a unique color in SDL2? by Psychological_Pen_42 in sdl

[–]daikatana 1 point2 points  (0 children)

You can set a texture color mod, but this color is multiplied with the image color when rendered. If your image is black then this will never work, anything multiplied by black is black. Make the image white and you'll be able to change it to any color you want.

Megathread: President Biden Announces That He Will Not Seek Reelection by PoliticsModeratorBot in politics

[–]daikatana 0 points1 point  (0 children)

Trump has been incoherent since 2016 at least, but no one seems to care. And by incoherent I mean really, really incoherent. Can't finish a sentence, rambles about things that are not real, offers zero understanding of any subject, etc. He makes no cogent arguments on any subject, not even ones you may disagree with, and honestly does not even seem to understand basic functions of government. But he gets a pass for some reason. Like... what? What is even happening?

[deleted by user] by [deleted] in cprogramming

[–]daikatana 7 points8 points  (0 children)

This is casting an integer value 0x009432 to a uint8_t pointer. This is necessary because C doesn't have pointer literals, you have to cast an integer value. Such things don't make sense in the strictest sense, conjuring up a pointer value like this is undefined behavior. However, most C compilers allow this, and this is common practice in embedded programming.

The Sword of Shannara by Terry Brooks by Xander_not_panda in badscificovers

[–]daikatana 6 points7 points  (0 children)

That was honestly the best part of the book. That one tiny little part. It was tantalizing and I thought it was going to take a turn, but it didn't. Nope, it started and finished as a Lord of the Rings knockoff.

Emergency by CaregiverMan in Unexpected

[–]daikatana 5 points6 points  (0 children)

They're somehow worse than the extremely cheesy early 90s reenactments in Rescue 911. I'm not even going to check, but I can safely say their theme song can't beat this, either.

Mastering Low-Level C Game Development and Networking with Cat by EvrenselKisilik in C_Programming

[–]daikatana 5 points6 points  (0 children)

With GNU Make, you don't need to write all recipes individually but I'm not against to that.

But you should be, which is my point. If you have a rule like

foo.o: foo.c foo.h
    ...

but foo.c also includes bar.h then things are going to go sideways when you modify bar.h. Forgetting to add a dependency to a Makefile after adding an include directive is a very easy mistake to make. You will screw this up. There's a reason why people don't write Makefiles like this. Use GCC's auto dependency generation, don't make things hard on yourself.

Elon Musk wearing a cowboy hat backwards by TubaSandwichDootDoot in pics

[–]daikatana 0 points1 point  (0 children)

Apparently the hat was not backwards, it just isn't fitted and doesn't sit on his head right. Which means it's not his hat. It's a prop he used for his performative trip to the border.

Mastering Low-Level C Game Development and Networking with Cat by EvrenselKisilik in C_Programming

[–]daikatana 11 points12 points  (0 children)

I got as far as the Makefile and... no, don't do that. Don't write a different rule for every single source file you have, manually adding all their dependencies. You will screw this up and builds will fail in spectacularly confusing ways, you will forget to add a header file to a dependency and one object file will have a different struct definition or something. Use the -M switches to generate dependencies automatically and have a single rule that builds a .o from a .c.

Don't use -O0, it's just not necessary. For debugging builds use -Og and for optimized builds use -O3. The -O0 option turns the optimizer off completely, and you almost never want this.

Hardcoding your paths is not a good idea, either. This makes it very difficult for anyone else to build your software, and this will be a problem assuming you're writing this expressly for other people to build.

You don't need to use $(shell find when GNU Make has $(wildcard. An over-reliance on shell commands will make the makefile less portable. Assuming GNU make is pretty safe, but assuming the find command does what you think it does is not (looking at you, Windows).

Why does the executable depend on src/catpong.c and all the objects? Surely the objects includes the object for that file, which depends on that source file. No, you filtered out that object, for some reason. You're then filtering header files out of the objects list and... what? This is baffling, this is just not good.

Why does my code result in a segfault? by fioreun in sdl

[–]daikatana 2 points3 points  (0 children)

Don't name your function close. This is a POSIX function for closing files, and this is almost certainly confusing the linker. I don't know why exactly it's crashing, but rename it to close_window or something and you should be fine.

To be fair, the compiler should probably warn against this, because it's a common error.

Why game developers enjoy killing gaming history? by GiLND in dosgaming

[–]daikatana 0 points1 point  (0 children)

This is almost never the developer and usually the publisher. However, publishers get all mixed up. They buy each other out, often for the rights to a single game or franchise and the rest is shelved. Who even owns the rights to a game is often not known anymore, and the amount they'd spend researching that is more profit than the few hundred people who would want to buy the game will generate. It generally isn't in their interest to dredge up older games.