re: C++
@wallhackio i’m not expecting C compilers to do the whole “actually we wait to make a copy until we are sure the object is going to be modified” dance but i do at least hope they are smart enough for “if this function never modifies the object and the object is not extern and only visible in a single thread, you don’t have to copy it”
C++
@wallhackio the first sentence is just swift, but they changed the rest of it to “now what if we let the compiler optimize all of that away”
if you get a phone number with an area code far from where you live identifying location-targeted scams is a lot easier i gotta say
@wallhackio this is essentially the only valid definition in C; i think C++ is fuckier tho
C++
@wallhackio don’t worry, no matter how much C++ you understand and enjoy, there will always be other C++ you don’t understand and hate
re: baldur's gate 3, minor spoilers
@wallhackio @alyssa oh i missed the word “also”, you can only get one
re: baldur's gate 3, minor spoilers
@wallhackio @alyssa bg3 wiki says “This statue costs 5,000 gold, and depicts whichever character is speaking to Boney when the purchase is made.” is the conversation locked to the protag or???
@jamey regarding using [0] and not &: this is a stylistic quirk i’ve picked up from Modern C, which takes the opinion that you should always use arrays when you know the pointer is not nullptr, and avoid & whenever possible. this definitely goes against existing practice but at this point i’m kind of inclined to agree? what you conceptually are doing with getline is passing in arrays with one slot each and it’s overwriting that slot. that’s just not how people usually write it.
regarding hardcoding, agreed. honestly i forgot about C23 constexpr while writing this code, and i think it could be cleaned up a fair bit by using it. i may try taking a stab at this.
regarding the indentation, i think that’s actually a bug in gitweb’s syntax highlighting :P
do you have any advice on naming global constants or struct members? this is probably one of the stylistic things i’m least certain about haha
@jamey the short version is i am trying to write a replacement for Gitweb (which i use, written in Perl) and Cgit (which i find aesthetically displeasing, written in C), which is to say, a CGI frontend for a directory of Git repositories. i’m doing this because i want something more configurable and don’t want to learn Perl, and i’m doing it in C because i want to get better at C and Cgit has already proven it’s possible.
so this commit is adding some code to process a path, provided to the CGI script, into a struct which represents its semantics. there aren’t any standards for this, but there is broad consensus on a format of `project/verb/base..target/subpath`. i’ve chosen some verbs that i’m planning to implement, like “log” and “show”.
because there is some flexibility in syntax, and to test the implementation, i’ve also written a serializer to get the canonical form of a path given the struct. the test code reads in a path from stdin, process it to a struct, and then serializes it back out. (it actually does this twice to confirm it is idempotent.) there is existing test infrastructure (in `sh/test.sh`) to compare the output of this program against the expected outputs and report errors.
so this is a very early step to enable me to start receiving and responding to requests over CGI, none of which is implemented yet.
in terms of code review, this is the first significant piece of C i’ve written in a long while, and i haven’t read that much C code either, so it’s kind of a shot in the dark. i’d be interested if there is anything significantly stylistically off, or if i am shirking best practices without good reason.
anybody good at C want to review this implementation <https://git.ladys.computer/CGirls>
@aescling “maybe ten kilobytes” might be wrong; i think i got this somehow but now i’m not reproducing it??
@aescling (i’m using git’s Makefiles as a base and apparently they do not believe in LTO by default)
@aescling *maybe ten kilobytes if you do -flto while building git as well
@aescling for the record this was without link‐time optimization; if you add -flto the size drops to just under one megabyte
Administrator / Public Relations for GlitchCat. Not actually glitchy, nor a cat. I wrote the rules for this instance.
“Constitutionally incapable of not going hard” — @aescling
“Fedi Cassandra” – @Satsuma
I HAVE EXPERIENCE IN THINGS. YOU CAN JUST @ ME.
I work for a library but I post about Zelda fanfiction.
For the time being, this is mostly a mirror of <https://status.ladys.computer/>. Want to get in touch? E·mail me!