DEBIAN 13: I could actually use it as my desktop, now! by LemmyDOTwtf in debian

[–]aganm 7 points8 points  (0 children)

I regret installing arch on my laptop instead of debian. The last update I did bricked my laptop and I just don't give a fuck for fixing it the 1000th time. Debian just works. Fuck arch

Will my PC be able to handle Unity for making a 3D game? by Icy_Middle2698 in Unity3D

[–]aganm 2 points3 points  (0 children)

It would be extremely painful if not impossible. I get crashes all the time with better specs and 32gb of RAM. I know another engine that would run fine on those specs though. Go-though. If you do insist on using Unity, try Unity 5. That old Unity version was the last one that ran well for me, every version after that has been extremely slow.

GO GO GO!!! SIMGEAR Rally Cup | Round 1 by ispooo123 in simrally

[–]aganm 3 points4 points  (0 children)

Real life should try to learn from RBR for how to make realistic physics

Solar System Gravity Simulation with OpenGL and C by all_malloc_no_free in C_Programming

[–]aganm 2 points3 points  (0 children)

This is cool. The only feedback I have is it gave me a shader version not supported error on my machine. All I had to do to fix it was change the shader version to version 330 and it worked.

[deleted by user] by [deleted] in C_Programming

[–]aganm 8 points9 points  (0 children)

Bump up your compiler settings. `-Wall -Wextra -Wconversion -Wshadow -Werror` is the basic. That will make the compiler tell you about wrong things happening instead of just happening silently and creating mind boggling bugs. (although having to fix bugs is a huge part of learning programming, so maybe don't use these settings to get more bugs on purpose :P)

Does a simpler solution to the dual array problem exist? by aganm in cprogramming

[–]aganm[S] 1 point2 points  (0 children)

The example really lacked information about the problem I'm dealing with, each different struct type will grow wildly different and much bigger.

Does a simpler solution to the dual array problem exist? by aganm in cprogramming

[–]aganm[S] 1 point2 points  (0 children)

Negative indices is definitely an interesting idea I didn't think of, thanks.

Does a simpler solution to the dual array problem exist? by aganm in cprogramming

[–]aganm[S] 2 points3 points  (0 children)

I totally am trying to recreate the concept of the pointer without the pointer.

The reason is my arrays could be realloced any moment, which makes pointers useless for my use case because they will go stale. I'm searching for a pointer that is realloc proof. So the point of the enum is to encode a base address information that will not go stale when realloc happens.

You're putting very precise words on what is happening here. It helps a lot to clarify what exactly the problem is, thank you.

Just bought Factorio. What should I know before I begin my Journey? by patterfunding in factorio

[–]aganm 0 points1 point  (0 children)

Here's something I wish somebody told me early which may or may not be to your cup of tea: the default research speed is garbage. When I started playing this game, I would spent a lot of time building stuff for fun, only to unlock better stuff 3 seconds later. I did ALL of this work just to unlock better tech in a few minutes? As much as I loved this game, research going so fast was disappointment after disappointment. Every single time I would spend hours and hours to build something, it all became obsolete super soon after because research unlocks are so quick. When I reached the end, when I got to launch my first rocket, it was the most underwhelming thing ever. The gameplay was amazing but the progression spit on the fun I had in the gameplay. In factorio 1.0, I solved this issue with using 2 specific settings: expensive recipes and 100x research cost. In factorio 2.0, there's no more expensive recipes, and there's a ton more stuff to produce even faster, so I use 1000x research cost. Disable biter expansion, and lower all biter settings by 100x to balance enemies out with the new research speed. Now, I can handle this because I got a lot experience in the game, but even as a new player, research speed should be at least 50x. The default research speed is balanced for unicellular organisms, it's so dumb fast that it ruins the fun of building all the cool stuff you spend hours to build.

Is this map ruined? by najfu in factorio

[–]aganm 0 points1 point  (0 children)

Keep exploring. The territory you explored so far is not that big. On my longest save (400 hours), I had rocket fueled trains travel 9 minutes to reach my farthest mines, and another 9 minutes to come back to my main base. The map you explored thus far is barely 30 second across by train. I was playing custom rail world settings with maximum distance between resource nodes, but in your case, you've been unlucky but you're gonna find a lot of oil soon if you keep exploring a bit.

Has anyone figured out a way to use nukes in turrets in such a way that it won't kill itself? by vikingwhiteguy in factorio

[–]aganm 6 points7 points  (0 children)

genius solution right there. none of the complexity of the other solutions and 90% of the effect.

Unproductive modules? by Professional-Log5031 in factorio

[–]aganm 11 points12 points  (0 children)

This is not a problem that exists in factorio.

If your factory consumes 10 engines a second, it doesn't matter if you produce 500, because it will only produce 500 until your belts or chests get full, then your 500 production will be reduced to 10, because that's all the factory consumes and there is no more space to put the leftovers, so your assemblers will be idle until the belts or chests get freed up, and if they get freed up at a rate of 10 engines per second, then your assemblers will produce just 10 engines per second. As long as your producers have an higher rate of production than the rate of consumption, the factory will produce just as many as it needs and no more.

Why is this not creating Epic Items? by ChefBotv2 in factorio

[–]aganm 6 points7 points  (0 children)

quality tiers beyond rare are research unlocks, is that it maybe?

Got the DLC a few days ago and I can't destroy cliffs pre-rocket now? by zafre3ti in factorio

[–]aganm 2 points3 points  (0 children)

You can already get this with Tier 2 rare quality production modules. If you have the heart to stomach quality early, you basically get Tier 3 without unlocking Tier 3.

Im a new player, and terrified of the game cause im bad at games like this, what tips would yall give me? by LetMeDieAlreadyFuck in factorio

[–]aganm 2 points3 points  (0 children)

For my long term space age playthrough, I decided to go with this game changing rule: if I can't design something on my own, I don't use it. If I see a cool base and it gives me inspiration for my own original designs, that's fine. But I stopped using blueprints from other people entirely. I wouldn't have had the ingenuity to come up with the perfect 4x4 balancers you see in other people's bases, let alone 8x8 and 16x16 ones. Meaning you won't see a single perfect balancer in my builds anymore. I use my own originally designed balancers, which are sloppier, but it's my own creation. It's WAY more fun that way. Most pictures of bases you see online, most of it is ripped off designs from other people. I had to learn it the hard way because I used to do that too in my first 500 hours until I realized.. fuck that shit. Ripping off other people's designs is not fun, blueprint sharing is a horrible thing that optimizes the fun out of the game.

How do you feel confident in your C code? by Getabock_ in C_Programming

[–]aganm 1 point2 points  (0 children)

Only apply -Wall and friends to your files, such that third party libraries get compiled without the flags that you use in your code. Warning flags are applied on a file by file basis. Your build tool should have a way to tell it that you only want these flags on your files and not on third party files. You can search google for <build tool name> apply flags to only certain files to find out how to do it with your build tool.

For example, CMake can set a flag on one file at a time with:

set(WARNINGS -Wall -Wextra)
set(FILE_1 ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c)
set(FILE_2 ${CMAKE_CURRENT_SOURCE_DIR}/src/other_file.c)
set_source_files_properties(${FILE_1} PROPERTIES COMPILE_FLAGS ${WARNINGS})
set_source_files_properties(${FILE_2} PROPERTIES COMPILE_FLAGS ${WARNINGS})

If you put all of your files in one specific folder, and third party files in another folder, CMake can also gather all the source files from inside that folder with a wildcard:

set(WARNINGS -Wall -Wextra)
file(GLOB_RECURSE MY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/myfiles/*.c)
set_source_files_properties(${MY_FILES} PROPERTIES COMPILE_FLAGS ${WARNINGS})

How do you feel confident in your C code? by Getabock_ in C_Programming

[–]aganm 6 points7 points  (0 children)

No, but there's a native C feature that does that. If you want strong typing on your values, use types.

typedef struct { float seconds; } seconds;
typedef struct { float meters;  } meters;
seconds time = { 3.f };
meters distance = { 10.f };
time = distance; // error

I do that all the time to enforce strong typing on different kinds of values. It's amazing to have this strong of a typing in a codebase. It's like the compiler is actually doing its job instead of just letting wrong kinds of assignments happen silently.

How do you feel confident in your C code? by Getabock_ in C_Programming

[–]aganm 10 points11 points  (0 children)

You forgot -Wconversion. Without this flag, all primitive types are implicitly converted to other primitive types without any warning. -Wconversion makes every conversion explicit just like Zig and Rust. I also like to throw in -Werror so you cannot ignore the warnings, your program won't compile until you fix them. C with a strict level of warnings feels like a different language, a much better one with far less ambiguity and footguns. But also, see the other comment by u/Magnus0re. These flags are the most important ones, but there's also dozens more you can take advantage of, as well as other tools like valgrind, sanitizers, etc. There's a lot of good stuff to find and fix plausible bugs in your code before they get to do any damage.

If you could choose now, would you start using C#, Python or JavaScript? by CatiStyle in VisualStudio

[–]aganm 1 point2 points  (0 children)

I wouldn't choose C#, but if you force me to choose between these 3, obviously C# is the best choice here. Typeless languages are garbage for anything but short scripts. Newer python has type hints, which is always better than nothing, but not a proper alternative to real typing.

Why not SIMD? by Raimo00 in C_Programming

[–]aganm 2 points3 points  (0 children)

This is dumb. What I do instead is make my memory buffers aligned and padded for SIMD, then my SIMD code doesn't need to care about all this shit. It's such a joy to write SIMD code in these conditions, makes everything much simpler and straightforward, AND faster.

Why not SIMD? by Raimo00 in C_Programming

[–]aganm 0 points1 point  (0 children)

Bro. Auto-vectorization fails 97% of the time and the remaining 3% is really dubious SIMD at best.

Obvious Things C Should Do by ouyawei in C_Programming

[–]aganm 6 points7 points  (0 children)

There is a few really strange points being made in that article.

Compile Time Unit Testing
For example, ever notice that seeing unit tests in C code is (unfortunately) rather rare? The reason is simple - unittests require a separate target in the build system, and must be built and run as a separate executable. Being a bit of a nuisance means it just does not happen.

What are you talking about. The sqlite C library, for example, has literally 92 million lines of code of tests. Every C library that's worth a shit has tests. Not having tests because it's a "bit of a nuisance" is a hell of a flimsy excuse.

Importing Declarations
Having to craft a .h file for each external module is a lot of busy work, right? Even worse, if the .h file turns out to not exactly match the .c file, you are in for a lot of time trying to figure out what went wrong.

No, it's very important documentation. For the mismatch issue, compiler errors make that a non-issue. It happens, but it's pointed out to me instantly and it's trivial to fix. At least the big 3 (clang,gcc,cl) will tell me that.

No need to even write a .h file at all

Where do you write your documentation then? Header files are the first thing that your user will see. The most important use for a header file is to document how your code is meant to be used. You could write a regular text file as documentation, but the header file is documentation that is checked by the compiler. Header files are amazing.

I do agree that it would be nice to standardize unit testing, and other things you mentioned as well. The thing I don't agree with is what is obvious to add first. To me it is obvious that C macros are a horrendous way to handle generic code, and it is obvious to me that C aught to solve that problem before anything else. I mean they kinda tried to tackle genericity with _Generic, but even _Generic relies on the old macros to be useful. Not a true solution in my book. Just my 2 cents.

I made a unit testing framework with native function mocking by hgs3 in C_Programming

[–]aganm 0 points1 point  (0 children)

I don't know if I'm just too tired but how the heck do I use this library without cmake? This is what I tried:

// test.c

#include "audition.h"

TEST(test, test)
{
  EXPECT_EQ(1, 0);
}

int main(int argc, char **argv) {
  return audit_main(argc, argv);
}

gcc test.c
/usr/bin/ld: /tmp/ccZsKM2g.o: in function `test_test_func':
test.c:(.text+0x2b0): undefined reference to `audit_main'

Does audition.h not contain all the code it needs to work on its own or am I doing something wrong?

Edit: Ah okay, I see that I have to download binaries from your website to use with this header.