← Home ← Back to /g/

Thread 107155808

42 posts 16 images /g/
Anonymous No.107155808 [Report] >>107156692 >>107156704 >>107158689
/dpt/ - Daily Programming Thread
What are you working on, /g/?

Previous: >>107133087
Anonymous No.107155861 [Report] >>107155911
Erlang is king!
Anonymous No.107155911 [Report] >>107156869
>>107155861
x86 MESI is king
Anonymous No.107156330 [Report] >>107156338
λ
Anonymous No.107156338 [Report]
>>107156330
>haskEL
literally an angel
Anonymous No.107156348 [Report] >>107156356 >>107156359 >>107156605 >>107156692 >>107160013 >>107160036
What do you name the internal variable that you will eventually be returning at the end of the function?
Anonymous No.107156356 [Report]
>>107156348
res
Anonymous No.107156359 [Report]
>>107156348
x
tmp
a
v
r
Anonymous No.107156605 [Report]
>>107156348
i try to avoid creating/naming such variables at all. If I have to, I name them something relevant to the domain, i.e. "volume" or "price" or whatever. Failing that, it's "res"
Anonymous No.107156618 [Report] >>107156672
>>107155257
using rdtsc before call longmp and after setjmp returns, the average number of number of cycles (100 runs) is between 1300 and 1450 cycles
it seemed like a lot so I looked at what libc does. in fact, libc setjmp is a thunk that jumps to the implementation of sigsetjmp which itself calls sigprocmask, itself calling pthread_sigmask. That's why it's slow as shit

replacing the libc setjmp and longjmp with this implementation https://nullprogram.com/blog/2023/02/12/ adapated for linux, the average number of cycles (100 runs) is now 40-45
Anonymous No.107156672 [Report] >>107156753 >>107156967
>>107156618
cnile syscallsters... i thought we were close to the machine?
Anonymous No.107156692 [Report]
>>107155808 (OP)
>What are you working on, /g/?
Fancy error logging for screen-matching tests.

>>107156348
ret
Anonymous No.107156704 [Report] >>107156715 >>107156871
>>107155808 (OP)
I just finished a minimal regex engine. I want to add backreferences and submatch replacement next.
Anonymous No.107156715 [Report]
>>107156704
>ruining the purity of regex
Anonymous No.107156753 [Report] >>107156764 >>107156833
>>107156672
Name something closer that isn't asm
Anonymous No.107156764 [Report] >>107156768
>>107156753
machine code
Anonymous No.107156768 [Report] >>107156780
>>107156764
That's asm
Anonymous No.107156780 [Report]
>>107156768
no it isn't
Anonymous No.107156794 [Report] >>107156894
When did C++ get so bad?
Anonymous No.107156833 [Report] >>107156979
>>107156753
forth
Anonymous No.107156869 [Report]
>>107155911
Anonymous No.107156871 [Report] >>107157186
>>107156704
nice, backtracking or the DFA? I've been continuing mine too.
by submatch replacement you mean sed's s///?
Anonymous No.107156894 [Report]
>>107156794
You dont need to use all of it
Anonymous No.107156945 [Report]
>tfw trying to learn graphics with an extremely spotty understanding of c++
Anonymous No.107156967 [Report]
>>107156672
It is but here it's a libc issue
Anonymous No.107156979 [Report] >>107157219
>>107156833
forth doesn't have machine types unlike C. the memory model is also further than C.
Anonymous No.107157186 [Report] >>107157248
>>107156871
>backtracking or the DFA?
DFA

>submatch replacement
I mean something like s/(group)rest/something\1/ . Just replacing the full match is fairly trivial, so I haven't bothered to write a function to do that, but I would need a separate function to do so with submatches.
Anonymous No.107157219 [Report] >>107157262 >>107157457
>>107156979
Machine types? No, you don't get fancy abstractions like in C, you work with chars only, the minimal hardware unit.
Memory model like in C? In Forth you work with the memory without call, ret, or stupid shit like procedural blocks, who needs that. Imagine needing a stack per function instead of using memory.
So yeah, lower level.
Anonymous No.107157248 [Report] >>107157364
>>107157186
>s/(group)rest/something\1/
>something\1
Ah, I see what you mean. The substitute function needs to be passed the array of captures but it also needs to treat the replacement string as a format string essentially. I hadn't thought about that, it's a bit more annoying that the case where the replacement string is fixed.
Anonymous No.107157262 [Report] >>107157319
>>107157219
>"""lower level"""
>abstracts away vector registers, call instructions, ret instructions, upper 7 bytes of general purpose registers, call stack
Sounds like it's hiding an awful lot, anon.
Anonymous No.107157319 [Report]
>>107157262
It doesn't "abstract away" shit, you can inline assembly like how shit is done in C.
Anonymous No.107157364 [Report] >>107159180
>>107157248
Yeah, it's a bit more annoying, but it's one of the useful features of regex match and replace and I want it in my library. It should also provide most of the machinery needed for backreferences (e.g. /(group|thing)\1/ to match groupgroup or thingthing), which is less useful but still neat.
Anonymous No.107157457 [Report]
>>107157219
standard forth has one type of integer and float iirc.
Anonymous No.107157800 [Report] >>107159444
>do some coding with OpenAL
>msvc build works
>mingw doesn't
>same error codes and logs in both cases
I will set this fucking computer on fire, I swear
Anonymous No.107158689 [Report]
>>107155808 (OP)
fuzzing my json parser
Anonymous No.107159180 [Report]
>>107157364
Do you use backreferences yourself btw? I've used regexes a lot for several years, I often use advanced features that I rarely see anyone else use, but I've used backreferences only ONCE for some CSV processing task where 2 fields must should have been the same and I know that if I had to redo that CSV task I wouldn't use regex backreference for this. I can't think of a single legitimate use case thor them.
Anonymous No.107159444 [Report]
>>107157800
Is cross platform why you're using mingw and msvc? Can't you use msvc for Windows and then gcc for building Linux?
Anonymous No.107159555 [Report]
Got this working.
Anonymous No.107159925 [Report] >>107160022
Hey, I recently coded this thing called a "Schizo Dot" which scrapes /x/ and /pol/ looking for posts that explicitly predict a future event then use Grok to assign that prediction a doom/hope score between -1 and 1 then at the end average all those together into an overall doom/hope score which is displays as a red yellow or green dot on the website as you can see here: https://schizodot.wtf

If you click "View Reasoning" and "View Chart" you have pretty much witnessed the project's entire functionality. Do you think if I make an automated X (Twitter) account that every 2 hours posts the Schizo Dot's predictions (as seen in "View Reasoning") and a screenshot of the current dot such as pic related, that this automated X account could grow enough to make me at least $100/month through X monetization? Keeping it running will be entirely effortless beyond my initial setup, and about $10 in monthly server costs. Thoughts?
Anonymous No.107160013 [Report]
>>107156348
result
Anonymous No.107160022 [Report]
>>107159925
if you live in some shithole without free speech like the UK or Germany, automatically reposting stuff from 4chan could land you in prison for years.
If you're in the US, go for it.
Anonymous No.107160036 [Report]
>>107156348
out, output
a name describing what the data is, like nums, lines