Conversation
Notices
-
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Sunday, 25-May-2025 16:23:55 JST
nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
Now I'm just tempted to write this entire thing in C instead. :chiggerniggaseverementaldistress: - pistolero likes this.
-
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Sunday, 25-May-2025 16:33:44 JST
nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
Reasons why I *really* shouldn't do this:
- Letting me write C is like letting a kid play with a knife. I will cut off my entire hand.
- Tons of manual labor in C that I wanted to avoid, which is why I chose Go to begin with.
- I need to learn more fucking Go.pistolero likes this. -
Embed this notice
Protoss (cyrillic@lab.nyanide.com)'s status on Sunday, 25-May-2025 16:34:58 JST
Protoss
@nyanide C++? -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Sunday, 25-May-2025 16:35:46 JST
nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@Cyrillic I don't know any and if I really cared for the extra features C++ offers I would be writing this project in TypeScript. pistolero likes this. -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Sunday, 25-May-2025 17:00:26 JST
gentoobro
C++ is just C except harder to read and with more useless boilerplate.
-
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Sunday, 25-May-2025 17:00:30 JST
gentoobro
Macros 😀
-
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Sunday, 25-May-2025 17:01:50 JST
nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@gentoobro Yeah duh. I'm like talking about the more mundane stuff like having to allocate appropriate buffer sizes for sprintf and what not. It's mind numbing and distracting and I just wanna get back to writing actual program logic. -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Sunday, 25-May-2025 17:06:04 JST
gentoobro
// allocates a new buffer and calls sprintf with it char* sprintfdup(char* fmt, ...) { va_list va; va_start(va, fmt); size_t n = vsnprintf(NULL, 0, fmt, va); char* buf = malloc(n + 1); va_end(va); va_start(va, fmt); vsnprintf(buf, n + 1, fmt, va); va_end(va); return buf; } Um... trivially abstract the boilerplate away?
-
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Sunday, 25-May-2025 17:06:57 JST
nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@gentoobro Yeah. You can do that. But I end up having to do that a lot when I write C. -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Sunday, 25-May-2025 17:07:31 JST
nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@gentoobro Not a bug isn't even loading here. -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Sunday, 25-May-2025 17:07:32 JST
gentoobro
https://notabug.org/yzziizzy/sti
Here's my general utility library in C. It includes a bunch of typesafe data structures, as well as a bunch of useful functions like the one above. Public Domain.
-
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Sunday, 25-May-2025 17:09:03 JST
gentoobro
Which is why I put all of those functions I wrote in a lib and now I just
#include "sti/sti.h"and add sti.c to the build script.
-
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Sunday, 25-May-2025 17:09:23 JST
gentoobro
-
Embed this notice
meeper (meeper@shitposter.world)'s status on Sunday, 25-May-2025 17:28:42 JST
meeper
@nyanide C is like a blunt knife that doesn't cut well unless you know the specific sharp bit and has a high risk of cutting you. In conversation permalink -
Embed this notice
Protoss (cyrillic@lab.nyanide.com)'s status on Sunday, 25-May-2025 18:12:31 JST
Protoss
@gentoobro @nyanide having objects and templates is very useful In conversation permalink Phantasm likes this. -
Embed this notice
Phantasm (phnt@fluffytail.org)'s status on Sunday, 25-May-2025 18:15:40 JST
Phantasm
@Cyrillic @nyanide @gentoobro Yeah, it is useful if you are writing something complicated and know how to actually use it. Like 80% of people writing C++ don't. In conversation permalink -
Embed this notice
Phantasm (phnt@fluffytail.org)'s status on Thursday, 05-Jun-2025 20:58:54 JST
Phantasm
@gentoobro @Cyrillic @nyanide Writing C++ like C with a few C++ features sprinkled in exactly how you write C++ if you don't understand it. It's the lazy route if you aren't competent enough with C++. If C with a few C++ features solves your problem, literally write in C since your project isn't complex enough to take advantage of C++.
TL;DR mostly a skill issue.In conversation permalink -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Thursday, 05-Jun-2025 20:58:55 JST
gentoobro
The problem is much worse than that. Responsible use of C++ is like how Casey Muratori does it, which it not much more than C with function overloading and a slight convenience in making math libraries. Anything more rapidly increases the depth of analysis necessary to understand any given line of code, which becomes a serious problem in large projects.
In conversation permalink