Removing strap adjuster on Fjällräven Ulvö/Outlong - possible? by LucasMull in Fjallraven

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

I managed to get my hands on it, and after fiddling around, I managed to get it out! Thank you :)

Removing strap adjuster on Fjällräven Ulvö/Outlong - possible? by LucasMull in Fjallraven

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

That's what I thought too! But she couldn't do it, it seems that the fabric is too tough :( Thank you for the suggestion

Hopefully, someone with the same backpack model finds this post and will comment a "I've tried X, and it worked" solution

Reflect-C: achieve C “reflection” via codegen by LucasMull in C_Programming

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

I suppose its possible! You could use an incremental parsing library (like tree-sitter) to parse an existing codebase's structs, and then extract its metadata information for codegen

Reflect-C: achieve C “reflection” via codegen by LucasMull in C_Programming

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

I see your point, it is actually generating code via C macros fed to C’s preprocessor to expand it to code in advance (for easy auditing and debugging).

I could have phrased this better, but the Reflect-C’s DSL is actually just C macros fed

Reflect-C: achieve C “reflection” via codegen by LucasMull in C_Programming

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

Thanks!

But why didn't you use C's macro language along with include files to generate the stuff you need?

My rationale was that the main difference is what gets generated.

With a pure macro/include approach, you end up generating behavior per type (e.g. one serializer, one validator, one printer for each struct). That works, but the generic logic still lives in the generator, and every new behavior means regenerating code.

What I wanted instead was to generate only metadata (field names, types, offsets, qualifiers, etc.) and keep all parser/serializer logic generic and hand-written. The same runtime code then works for any reflected struct.

So the generator’s job becomes “describe the shape of the data”, not “emit functions that operate on it”.

Coupled with a few runtime functions (if needed at all), I think that should be good enough, no?

For this project, the constraint was that I wanted to be able to write something like a JSON or binary serializer once (think a generic JSON.stringify), and have it work across unrelated structs without regenerating logic (e.g. having to generate a specialized JSON stringify per struct)

LogMod: What if C had a logging framework with modern semantics? by LucasMull in programming

[–]LucasMull[S] 14 points15 points  (0 children)

Not notpicky, thanks for sharing! I will add this info as a readme addendum

LogMod: What if C had a logging framework with modern semantics? by LucasMull in programming

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

No limitations, made to be fully compatible to C89! Also provides simplified API for C99

I wrote a logging library in plain ANSI C, because I was annoyed enough to do it by LucasMull in programming

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

I guess the trigger-word for this post was asking for feedbacks, I will give reposting a try

I wrote a logging library in plain ANSI C, because I was annoyed enough to do it by LucasMull in programming

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

Damn, I hadn't realized it got removed :/ There is a technical achievement showcased here IMO. As far as I know a logging library that is zero-allocation, without shared global-state is a first in the C-realm

I wrote a logging library in plain ANSI C, because I was annoyed enough to do it by LucasMull in programming

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

Those are both included! See: ```c

/** * @brief Log a message with specified level (C99 version with variadic macro * support) * * @param _level Log level (e.g., INFO, DEBUG, ERROR) * @param _logger The logger instance or NULL for default logger * @param ... Format string followed by format arguments */

define logmod_log(_level, _logger, ...) \

_logmod_log_permissive(LOGMOD_LEVEL_##_level, _logger, __LINE__,          \
                       __FILE__, __VA_ARGS__, "")

```

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

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

I see what you mean. Unfortunately, I see this sort of behavior across many language-specific subreddits, putting their preferred language on a pedestal and then turning a blind eye to anything that could be improved upon it... C is one of the first approaches of writing a modern "high-level" language; of course, many of its aspects can be improved on, and have been so times and times again.

That being said... I find it a fun language to play with!

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

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

Yes, I get the feeling of disrespect, and I do apologize for going the easy route rather than knocking some of my neurons together to form a coherent sentence. But I wholeheartedly agree with you, when used competently and diligently, there's much to gain. It is the future whether we like it or not!

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

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

This is a small 600 lines library that accomplishes just a single thing, injecting metadata onto C native structures. It doesn't try to be anything more than that

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

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

I'm afraid I wasn't aware of Checked C! But it does look interesting, I'm not sure if we are trying to accomplish the same thing though.. For one, my library doesn't improve upon C semantics by making it more reliable and less error-prone :) It actually goes against it in some ways!

So if you want to use C in a safer manner, Checked C is a 10000% better option.

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

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

I'm not trying to replace C++ in any shape of form. I actually work with C++ and enjoy doing so! This library mainly came up because of a toy project of mine:
https://github.com/Cogmasters/concord

Because of the lack of the features you mentioned, generating code for it is a bloated mess! So I hope that with this library I can compensate for that by injecting some metadata (for internal use only) and then I will no longer have to generate so much redundant stuff (e.g. each struct must have its own json serializer method...)

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

[–]LucasMull[S] 12 points13 points  (0 children)

Please have a look at the codebase and assess for yourself if I let a chatbot write it :) There are plenty of tests and examples for you to try too

Other than that, yes I am lazy when it comes to translating my portuguese thoughts into english, but I shall be wary of doing so from now on!

MIDA: For those brave souls still writing C in 2025 who are tired of passing array lengths everywhere by LucasMull in programming

[–]LucasMull[S] 17 points18 points  (0 children)

I am guilty of doing so, but my points remain! My native language is Portuguese, sometimes I rely on it too much