Top
Best
New

Posted by synergy20 10/24/2024

Pretty.c(github.com)
370 points | 221 commentspage 2
textread 10/24/2024|
Is it possible to tangle the Readme into pretty.h? In other words, are the codeblocks in the orgfile exhaustive.

I love the literate way you have explained your thought process in the readme.

aartaka 10/24/2024|
Yes, code blocks in Org are executable, but I was aiming for simple embedding and zero build-time, thus conservative choice of separating README and the actual header.
yjftsjthsd-h 10/24/2024||
I have not decided how I feel in general, but:

> Everyone defines these, so why not provide them?

Honestly, that's fair.

dymk 10/24/2024||
> turn any codebase into a beginner friendly one

Okay then.

I was hoping to see a “this is just for fun” disclaimer but didn’t see one. Please never actually use this in a project that other people will have to read or contribute to.

ipsum2 10/24/2024||
> Provide so much syntactic sugar as to cause any C developer a diabetes-induced heart attack.

seems like its obvious to me that its a joke

rebolek 10/24/2024||
It's a joke that I would happily use.
AnthonBerg 10/24/2024|||
C is funny, in many ways.
aartaka 10/24/2024|||
You're welcome!
thiht 10/24/2024|||
Not everything needs to be stated explicitly, where's the fun in that?
TheRealPomax 10/24/2024||
No promises, people who want to have fun are going to have fun despite requests not to have fun.
mydriasis 10/24/2024||
Wow, neat! The wildest part to me is

> And it’s backwards-compatible with C and all of its libraries!

I can't wait to give it a shot! This looks like a riot.

geon 10/24/2024|
Have you heard of Zig?
oguz-ismail 10/24/2024|||
It requires a different compiler. This is just a collection of C preprocessor macros
ptspts 10/24/2024||
The Zig toolchain can compile both Zig and C.
klardotsh 10/24/2024||
Yes, but the Zig toolchain is not $YOUR_EXISTING_C_COMPILER_YOU_ALREADY_KNOW_AND_USE
geon 10/29/2024||
It is, if you use clang.
mydriasis 10/25/2024|||
I hadn't yet, but it does look nice. I especially like that you can just say "defer deinit", that's really nice.
jay-barronville 10/24/2024||
This project looks really cool! Unfortunately, there’s just way too much magic involved. In my humble opinion, C is simply not the language for this level of magic—extreme use of macros (and hidden behavior in general) is how you end up with hard-to-detect (and hard-to-debug) bugs and security vulnerabilities. As cool as this project looks, I’d never feel comfortable using it in anything serious. A+ for the effort though!
lpapez 10/24/2024||
All that is missing is a garbage collector. Should be possible to implement one by overriding malloc & friends?
vidarh 10/24/2024|
You can use the Boehm-Demers-Weiser GC with C. It's conservative, because it has to be with C, so it may/will miss things (it will treat integers etc. as potential pointers, and so avoid freeing anything "pointed to" by them), and so it works best as an extra layer of protection/leak detector, but it can be used as a replacement for freeing memory too.
drbaggy 10/28/2024||
Being able to control indents for a particular case { right-aligning variable names - while keeping "=" in line can be useful for instance }... Is the perfect example of why indenting should be left for the eye of the reader not the computer.

It's exactly why I find python code difficult - nay impossible - to read at times.

So you are really doing absolutely the opposite of what you are claiming...

Obviously beauty is in the eye of the beholder - but the one thing that C got right was using "{" & "}" to specify code flow.

nanis 10/24/2024||
> if (argc above 1)

I give up.

aartaka 10/24/2024|
You're welcome!
OsrsNeedsf2P 10/24/2024||
This is terrifying
aartaka 10/24/2024|
Thanks!
DeathArrow 10/24/2024|
This should have been invented 50 years ago!
aartaka 10/24/2024|
Yes, and it's a shame that underlying features were only shipped in C11 (generics) and C23 (auto type inference!)
More comments...