Show newer

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”

‹ -:160: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xE2 0x81 0x20 0xE2 ›

oh my god they’re doing a naïve replacement of NBSP to SP

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

Show thread

those WSDOT scammers are really at it huh

@wallhackio this is essentially the only valid definition in C; i think C++ is fuckier tho

i haven’t used pandoc seriously in like five years but i still always check the release notes

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???

currently at the “getting my Clang from Homebrew” stage in my life

@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.

deciding that my shell script style is to place a colon after `then`, `else` and `do` just to fuck with people

@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

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.