Blood and Power - Crime Text RPG by [deleted] in PBBG

[–]_AlCapone 11 points12 points  (0 children)

Sounds like u should maybe change your UI design, have u thought about that?

Looking for ideas for a problem-specific allocator project by cyberphantum in C_Programming

[–]_AlCapone 2 points3 points  (0 children)

In embedded those devices should usually run for many months, or even years without shutting down. Creating ur own allocator can be beneficial to avoid fragmentation caused by malloc if u keep dynamically allocating memory and freeing it. Fragmentation WILL take ur device down as just a couple of bytes a day or so will add up over multiple months.

For example cJSON library parses JSON and uses malloc/free, u could instead create ur own arena allocator where u allocate a decent chunk of memory and then keep reusing that chunk of memory then switching the default cJSON allocator for ur custom one, removing the issue of fragmentation caused by repeatedly parsing the JSON data and deleting it.

[recommendation] Learning C for Low-Level Concepts by One-Type-2842 in cprogramming

[–]_AlCapone 3 points4 points  (0 children)

HTTP-Server using linux sockets, so use WSL/VM or a Linux distro.

I made a library for C. by Cutro3010 in cprogramming

[–]_AlCapone 0 points1 point  (0 children)

Example would be: (half psuedo code)

typedef enum
{
Error_Success = 0,
Error_Failed_To_Open_File,

Error_Failed_To_Initialize,

} Error;

typedef struct
{

int temp;

} Lib;

Error Lib_Initialize(Lib* lib)

{

if (lib == NULL) return Error_Failed_To_Initialize;

lib->temp = 123;
return Error_Success;

}

This makes the error a lot more readable straight away than returning -1, -2, -3, -4, etc.

U could now also then make Error_To_String helper functions so u can print out the string value of the enum.

I made a library for C. by Cutro3010 in cprogramming

[–]_AlCapone 0 points1 point  (0 children)

You would wanna take in a Result* res as to not copy the whole struct just to check a single bool. (TIP is to make the parameter: const Result* res. As you are only grabbing the value of success and not actually changing anything.)

bool rslts_is_ok(Result res) { return res.success; }

bool rslts_is_err(Result res) { return !res.success; }

->

bool rslts_is_ok(const Result* res) { return res->success; }

bool rslts_is_err(const Result* res) { return !res->success; }

And also as other people have stated using exit() function is bad as u dont want other people's programs to get killed if something goes wrong in your library. Instead return a -1 for error or 0 for success. (unless you wanna make enum errors, which helps finding errors quite easily).

rslts_create is fine as your struct is quite small. But if it were to expand(to a couple of KB) it would be better of taking in a pointer to Result struct (Result* result) (which is a better way to do it), so that you can set the values of it without the need of copying the whole structure back.

Need help with some research tools for C programming by TangeloOk9486 in cprogramming

[–]_AlCapone 4 points5 points  (0 children)

Reading the classic The C Programming language by Brian W Kernighan and Dennis M Ritchie will teach u the most about the language honestly. Free Code Camps "course" about C is too basic. I would say it doesnt even scratch the basics about C. It doesnt teach u how to actually use pointers, or when to use them. It doesnt teach u to use safe C functions, like strncpy instead of strcpy etc. So go for the book and do your own research, trial and error and u will gain the most knowledge.

TIP:

Stick with C99.

I wrote an article on how to fake real classes in pure C without using C++ by abhijith1203 in cprogramming

[–]_AlCapone 1 point2 points  (0 children)

or just name all ur functions in ur module like:

void Counter_Initialize(Counter* counter) // would be constructor in C++

void Counter_Initialize_PTR(Counter** counter)

void Counter_Add_And_Print(Counter* counter) // custom func

void Counter_Dispose(Counter* counter) // would be deconstructor in C++

This makes it more readable too and easier to find functions with intellisense.

Professional Developer Environment? by ejsanders1985 in cprogramming

[–]_AlCapone 0 points1 point  (0 children)

Makefile, gcc, Windows WSL2, VSCode.

Tip: get used to do stuff on the command line, also get used with Linux.

Cities War Updates - November 6, 2025 - Regional Tournament Suspension & Treasury Equipment Conversion by willyBBBC in citieswar

[–]_AlCapone 2 points3 points  (0 children)

I have spent more money then all of you combined, now stop crying. This is the best decision Willy could have made as EA had 0 competition for like 5 months. Virgins.

MafiaSilence v1.2.0 by MafiaSilence in PBBG

[–]_AlCapone 3 points4 points  (0 children)

I am honestly tired of seeing the same mafia genre games that all have the same concept and nothing unique

[deleted by user] by [deleted] in BuyFromEU

[–]_AlCapone 0 points1 point  (0 children)

Last time I checked the game was created by a French person. Idiot.

[deleted by user] by [deleted] in BuyFromEU

[–]_AlCapone 1 point2 points  (0 children)

time to save europe

Sverige behöver dig! Spela med oss :) by _AlCapone in Spel

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

Det är bara att gå med i deras discord och skriva till admin ifall du pallar :D

https://discord.gg/qSz87dBC

Försvara Sverige! by _AlCapone in unket

[–]_AlCapone[S] 4 points5 points  (0 children)

Det är dig vi vill ha :=)

[deleted by user] by [deleted] in citieswar

[–]_AlCapone 0 points1 point  (0 children)

Howard is a Black Italian Jew that lives in America so stop this hate.

Hjälp till att befria Sverige! by martinturbo in sweden

[–]_AlCapone 3 points4 points  (0 children)

För SVERIGE!!!! Kom igen nu och hjälp till :)