<bslsk05>
github.com: simh/PDP11/pdp11_cpu.c at master · simh/simh · GitHub
<geist>
well it's actually fairly consistently formatted, the style is just fuckin weird
<zid`>
this looks really normal
<zid`>
other than the }
<nikolar>
Oh indented }
<nikolar>
Yuck
<nikolar>
But yeah seems pretty tame otherwise
<geist>
wel indented } and the other hard thing to read (that's not obvious on the web page) function bodies are not indented one
<zid`>
yea weird
<geist>
that makes it incredibly hard to tell where functions start/stop
<geist>
but i guess gets you effectively a lost tab back, which if you're on some vt100 terminal with 8 space tabs... i guess that's a thing
<nikolar>
Heh
<heat>
geist, kernel normal form was and is pretty alright
<nikolar>
For the most part
<zid`>
nikolar is it day 13 yet
<nikolar>
I don't get the return (whatever)
<geist>
separate line { } really drives me nuts but i see it as being pretty valid
<zid`>
I kinda wanna do an aoc again already
<geist>
idented } is weird though
<heat>
old win nt style is also okay despite the culture clash between unix and the DEC man
<nikolar>
zid`: no
<zid`>
the only horrible style that's actually in common usage is gnu's lol
<geist>
if() vs if () i used to do myself but switched in the 2000s
<nikolar>
I used to do if() too
<geist>
ie, make statements like if and for have a space before the ()
<geist>
and yeah years ago i used to always return ()
<zid`>
I still do if() and I'd like to change but.. I can't be bothered
<zid`>
*that* one is weird
<zid`>
That's weirder than the non-indented function bodies :P
<heat>
i'm slowly over time stanning same line {
<geist>
yeah i stopped, it was just picked it up somewhere. i think the idea was having 'naked' looking expressions like that with return looked funny to me
<heat>
looks just a little more compact whilst being legible
<zid`>
I like that it's a little bit less tall, but I dislike more, the unevenness
<geist>
since i dont think there's anything else like that
<nikolar>
heat took you a while
<geist>
without a = on the left side at least
<zid`>
geist: sizeof x or sizeof(x) or sizeof (x) though
<heat>
sizeof(x)
<zid`>
*gags*
<nikolar>
What's the reasoning with return (x)
<heat>
not even a question
<geist>
true, but i also never ever write sizeof without ()
<heat>
sizeof x is for musl programmers
<nikolar>
I do that
<nikolar>
And I don't musl
<geist>
in fact until you just mentioned it i totally forgot you could!
<zid`>
nikolar: We should form a support club
<nikolar>
What for
<zid`>
People terrorised by other people who write sizeof(x)
<nikolar>
Lol
<nikolar>
Good idea
<geist>
heh not sure i've seen much standalone sizeof in any code base i've looked at recently
<geist>
you are in for some ptsd
<nikolar>
Kek
<heat>
i've seen it in musl and.... nothing else
<nikolar>
I mostly read the code I've written so it's fine :P
<zid`>
geist: to be fair, 99% of the time, it isn't valid to remove them
<nikolar>
Yeah
<zid`>
So you need to overcount them by 100;1
<zid`>
the last time I wrote it was.. 3 days ago :P
<zid`>
only for replacing if(a) b = c; else b = d;
<heat>
ternary with omitted operands is MEGA BASED
<zid`>
as in, boolean test on a value
<zid`>
no embedding fucking commas (I bet heat does that)
<geist>
there was some based thing i saw i think sortie doing at some point with regards to exiting a function and conditionally setting errono
<geist>
i think it was ternary based + comma operator
<zid`>
see
<heat>
no, sortie just does the comma operator, no ternary i think
<geist>
i thought it was something like
<heat>
like return errno = ENOMEM, NULL;
<nikolar>
Ternary based
<nikolar>
I wish a ?: b was standard
<geist>
`return (err < 0 ? errno = err :,err)
<geist>
or something like that
<nikolar>
Ah neat
<zid`>
nikolar: like, as a conditional-overwrite-or-don't-touch?
<geist>
that's almost certainly broken, but was somethinglike that
<nikolar>
zid`: yeah
<nikolar>
So a ?: b is a ? a : b
<zid`>
eh I don't want it if that's what it does semantically
<nikolar>
Neat for null checks and such
<zid`>
I need it to be a ? : b;
<zid`>
with nothing on the left side
<geist>
i think the (a ?: b) has the property of only evulating it once?
<nikolar>
What would that do
<zid`>
see geist
<nikolar>
Yeah, it's only evaluated once
<geist>
so in some C++ stuff that's pretty powerful when those types can be complex
<zid`>
like, I don't want it to turn into a = a; in one case
<geist>
SPACESHIP OPERATOR
<nikolar>
I guess more accurate would be tmp = a; tmp ? tmp : b
<zid`>
goestoward operator
<heat>
my kernel has around 400 ternary expressions
<nikolar>
Nice
<zid`>
how many goestoward heat
<heat>
30 ?:
<geist>
nikolar: right but then the trouble there is the tmp copy could hit a copy constructor, etc and do extra work
<nikolar>
I don't c++ :)
<geist>
so it's bettter if the RHS of the eval does directly to the return, or something like that
<nikolar>
I am talking exclusively about c here
<zid`>
I wrote a lexer so I can tell you precisely how many ?: my code has without accidentally including "Hello? Fuck you :)"
<geist>
one day for a brief moment i had a flash of insight and fully grokked RHS vs LHS and now move and && worked and whatnot
<nikolar>
Kek
<geist>
the skies opened and angels tooted their trumpets
<geist>
i was walking across the google campus and i saw all the youngsters on their colorful bikes
<geist>
all was well
<zid`>
nikolar: I wanted it for mmmmmio
<zid`>
so that it didn't do MMIO_A = MMIO_A; in the false case
<geist>
also i had a free latte
<nikolar>
Or, you can just choose a language where you don't need to solve a riddle for every operator you use :P
<geist>
but that wasin the before times.
<heat>
yeah, before the inflation
<kof673>
that's when various characters tend get stoned :D ^^^^^^^^^^^^^
<kof673>
*tend to get stoned
<kof673>
the stoney kind of stoned lol
<geist>
before the pandemic made it all dissapear and never return
<heat>
nikolar, which language would that be
<nikolar>
C
<geist>
now my lattes are less frothed
<nikolar>
Even rust
<heat>
is it?
<geist>
boo how do i work with this?
<heat>
fuckin
<heat>
unsigned short a = 0; __typeof__(a + 0)
<geist>
well, i think that's mostly against the employee handbook
<geist>
oh side note i wrote something using C11 Generics the other day
<heat>
WHAT
<geist>
it was pretty good. sadly C++ does not understand it, so you can't really use it in a mixed environment header
<heat>
does google know you're writing C at work?
<geist>
i wanted to write basically a type aware macro like thing
<geist>
oh no this was for LK
<heat>
does google know you're writing C outside of work?
<geist>
i have tenure
<nikolar>
heat: int, next
<heat>
i think it's against the employee handbook
<geist>
well, i was really saying the employee handbook was against fuckin at work
<geist>
*probably*
<heat>
fuckin is less serious than writing C, to google
<geist>
more home grown googlers!
<nikolar>
Kek
<geist>
heat: been kinda fun, been a whiel since i wrote SMP bootstrap shit for x86-32 and -64
<geist>
so been doing it yet again on LK without consulting anything else
<geist>
kinda nice to see how much GDT and whatnot shit you remember off the top of your head
<heat>
oh that's nice
<geist>
also i think it's time to switch to per-cpu GDTs instead of one. one fatal flaw with having a single GDT with per cpu TSS/etc entries, is on x86-32 you want to probably have a single gs *value* that you just blat into the cpu on exception entry
<geist>
and that means having a per cpu gdt with a different segment descriptor in that slot
<geist>
*or* a LDT i guess
<heat>
here's a really fun fact: clang++ understands _Generic
<geist>
on x86-64 this doesn't matter beause the whole gs: nonsense is pointed to by setting MSRs
<heat>
yay swapgs
<geist>
yeeep. swapgs :(
<heat>
the best instruction ever
<heat>
WOAH we have swapgs hater in the room
<geist>
yeah that was a huge mistake, tons of bugs as a result of that getting out of whack
<heat>
if you want extra fun you should parse and load microcode
<geist>
they should have designed it as `setgs 0` `setgs 1`
<heat>
it is Not That Hard
<geist>
protip if you design any hardware never ever implement things as toggling without a way to read the current state
<geist>
that a sequence bug waiting to happen
<nikolar>
Oh yeah that's horrible
<zid`>
nikolar: What about ?: for tokens?
<nikolar>
?
<zid`>
thinking of AoC day7 where you had to either add or multiply
<zid`>
based on a flag
<zid`>
a = a (flag #? + : *) 4;
<zid`>
idk how you'd terminate it though
<nikolar>
Oh yuck
<nikolar>
No
<zid`>
ikr it's insane, I love it
<zid`>
I bet rust can do it
<nikolar>
You'd probably use that like twice in your whole life too
<zid`>
Sounds like a job for C++ then
<nikolar>
Yes
edr has quit [Read error: Connection reset by peer]
mpetch has quit [Quit: Client closed]
Celelibi has quit [Remote host closed the connection]
graphitemaster has quit [Ping timeout: 260 seconds]