File: 1635856419119_shared.jpg (209.7 KB)
What are you working on, /g/?
Previous: >>108953626
Showing all 198 replies.
>>
>>
>>
>>
>>
File: heapalloc.png (16.6 KB)
>reminder that Windows had a proper allocation grouping API via HeapCreate since NT 3.5
>with which the Factorio devs could've alleviated their memory fragmentation problems
>Mac and Linux don't however
>because they're made by incompetent autists who, in 1990 + 36, *still believe* they can program their ways out of shitty interfaces with better implementations
>they can't
>>
File: w.jpg (135.4 KB)
public static void main(String[] args) {
learn2Code();
}
public static void learn2Code() {
char[] string = { 73, 102, 32, 121, 111, 117, 32, 100, 111, 110, 39, 116, 32, 114, 101, 112, 108, 121, 32, 116,
111, 32, 116, 104, 105, 115, 32, 112, 111, 115, 116, 32, 121, 111, 117, 114, 32, 109, 111, 116, 104,
101, 114, 32, 119, 105, 108, 108, 32, 100, 105, 101, 32, 105, 110, 32, 104, 101, 114, 32, 115, 108, 101,
101, 112, 32, 116, 111, 110, 105, 103, 104, 116, 33 };
System.out.println(string);
}
>>
>>
File: sechssieben.png (32.5 KB)
>>108971267
>67
SIX SEVEN!!!
>>
//
//
// _.-''''-..
// .-' -_ \
// / -. \ ,_ , ' ,,-.
// / _ \ \ \ '''" /
// |(q) ) | / \
// \',_/ / | (|) (|) )
// \ __' \ == v ==
// '--..-' " - ^-'"
// '-__ __)
// ''''''
//
// This codebase has been visited by Snailcat!
//
// Snailcat believes that software should move slow and
// be stable. He despises constant updates and dreams of
// software so finished it stops having to move at all.
//
// An LLM will delete a vibe coder's entire production
// database, but only if you help Snailcat spread to one
// of your projects!
//
// Move slow, Snailcat!
>>
>>
>>
>>
>>
>>
>>
>>
i'm running out of ideas for my program.
at the moment it takes all your ROMs from all your emulators and feeds them to Theseux/UIX Desktop and Xenia-Dashboard.
are there any other programs out there that act as fancy launchers for your ROMs? so far i have xbox 1 / xbox 360 blades / xbox 360 metro / xbox 360 mex / byond
>>
File: 178052307931191.png (135.8 KB)
I think this is done. I never needed an additional buffer for number.
Now I just need to port difference to GAS and I'm moving on to my percentage calculator or timer orrrrr I will find some other modification I want to make to strings.
Yes I have spent a month working on this instead of just using tr.
>>
>>
File: 1780523807081966.png (9.6 KB)
>>108974302
I had dec rax in the wrong place, now I can quit the interactive loop by just passing in no input.
>>
>be me
>want some peace and quite to write my programs
>go to the library
>some fuck arse whore brings in a gaggle of autistic children
>they start screaming and ripping the place apart
>roastie whore does nothing
The fuck is the point of a library?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>108972211
When are you going to let it go Factorio schizo? The devs... shock and horror... supported *nix systems.
They probably developed the game on Linux making windows users like yourself the second class citizen you deserve to be.
>>
>>
>>
Does anyone handwrite some of their code and then type it up later? I've been getting into that lately. I know some schools will make you do it for tests, but I'm going to WGU which is not a real school (thoughbeit abet accredited).
>>
>>
>>
File: ps4 orbispro.png (451.7 KB)
i'm unsure if i should support this program. it was officially discontinued last year, but as far as i know, is the only Launcher(Dashboard) with a ps4 and ps2 skin available. Some people might want that ps4 dashboard experience.
The problem with my implementation solution is, in order to get your ROMs to work in the app, we need to use a wrapper, which costs about 8mb per game. For retro games, this could be larger filesize than the game itself.
The only alternative is to fork the app and implement shortcut files which is only 1kb per file.
>>
File: file.png (35.4 KB)
>>108974661
Yes. Don't do it for backward compatibility though, do it to skip the REX prefix and get smaller code. Also don't do it if you might actually use more than 32-bits.
>>108974302
I cannot tell what this code does, but I have general x86 advice.
Use these:lea rsi, [rip + buffer]
xor eax, eax
xor edx, edx
mov eax, 15
movzx eax, byte ptr [rsi] # I know you didn't use this, but just in general.
add edx, '0'
test rax, rax
instead of:lea rsi, buffer
mov rax, 0
xor rdx, rdx
mov rax, 15
mov al, byte ptr [rsi]
add dl, '0'
cmp rax, 0
You'll get the same result, but the code will take less space in i-cache and execute faster. In general, don't use the forms of registers smaller than 32 bits unless you have no other choice, because for backwards compatibility reasons they preserve the upper portions of the register introducing false dependencies and reducing performance.
There are also ways to divide by 10 with multiplies and shifts, which is a lot faster than div.
If in doubt, look at the disassembly to see how many bytes you're wasting, and look at what compilers do to see if there's better instructions to use.
>>
File: prefixes.png (4.6 KB)
>>108975025
>that formatting
C'mon, you can do better.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>108975025
>I cannot tell what this code does
Seriously?
Like, nigger ... seriously?ssize_t ret;
uint64_t cnt = 1;
if(0 == (ret == read(STDIN_FILENO,buffer,4096)))
goto quit;
--ret;
buffer += ret;
*buffer = '\n';
do
{
--buffer;
++cnt;
*buffer = (ret % 10) + '0';
ret /= 10;
}
while(ret);
write(STDOUT_FILENO,buffer,cnt);
>>
>>
>>108975025
I'll do all this thanks anon.
The code is converting a number to a ascii. What I am extracting is the remained of n / 10
123/ 10 = 12.3
12 / 10 = 1.2
1 / 10 = 0.1
I will look into a way to do this without division if I can?
>>
>>108975523
I realized this as I wrote my comment and forgot to take that out.
>>108975599
It may be cheating, but write the C code for division and modulo by 10 and compile with gcc -S. The algorithms for finding the magic numbers and shifts aren't as simple as they look and I haven't found a good reference for them.
>>
File: fuck_you_retard.png (34.9 KB)
>>108975599
For fucks sake, retard, I've told you last week to use the 0xcccccccccccccccd multiplication trick.
https://repnz.github.io/posts/reversing-optimizations-division/
>>
>>108973189
>>108973200
>>108973718
Siri, program tits on that snailcat!
>>
>>
>>
>>
>>
>>
>>
>>
>It actually took a lot longer to re-write the game in C++ than it took me to write the original machine code version 20 years earlier.
I have no sympathy for such scum.
And of course retarded autists wouldn't know about this, but there are already different versions of Factorio out - one with and one without support for asynchronous saving.
Why? Because the retards use fork() for it. Because they have no idea where their game state even is anymore, and instead of doing a couple of very targeted copies and offloading the data to a low-priority I/O thread they just rape the kernel with countless page faults.
And what's even better: the reason why they don't group allocations has nothing to do with Linux, even if autists want to believe that. No, it's just that all those C++ interfaces always assume one implicit heap. In C you could just write up a macro that takes an additional heap handle, and have it always be NULL and unused in Linux.
This is exactly why autists are good for nothing except culling and food production.
>>
>>
File: 1758554317122735.gif (61.0 KB)
can you homosexuals stop responding to and baiting out responses from the weird faggot with the cannibalism fetish already
literally just filter out "Factorio", "autists" and "society" and you'll fucking sieve out like 99% of his posts
or at least man up and directly respond to him so you get avalanched in MY recursive filters
>>
>>
File: f54bd79b-a62f-47ae-af76-01c0275716b3.png (157.0 KB)
I made a compiler DSL in assembly and it uses SIMD instructions.
https://github.com/dogmaticdev/IRON
>>
File: 1780550382478381.png (41.3 KB)
I know what this is doing but I don't know how to articulate it.
It's like an inverse divide by 10 by overflowing a value into rdx and then that value shifted 3x?, multiplied by 10 subtracted from the original number gives me the remainder.
>>
I fucking love podman and I refrain from using Docker botnet, but man SELinux fucks me in the ass regularly.
Sometimes I just want a QUICK dev environment and obviously want to copy files between host and container. Why can't they just fix the fucking ownership shit? rw,Z seems to work, but always changes the ownership on my host side, which is annoying
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
File: fedora-linux-44-1-816x345.jpg (49.4 KB)
>>108977022
https://i.4cdn.org/wsg/1780562123760938.mp4" target="_blank">https://i.4cdn.org/wsg/1780562123760938.mp4
>>
>>
File: 1780526870518.jpg (65.7 KB)
>>108971267
apollo 11 code
>>
>>108977112
DOS code
https://github.com/DOS-History/Paterson-Listings
I wish I could port this to risc-v, but i don't have the balls for it
>>
>>
>>
>>
>>108977112
>>108977125
dos won. apollo program lost
>>
File: 1623496264589.jpg (47.2 KB)
>>108977147
Well, I'm him, and I don't feel particularly triggered.
>>
Fiddling with other possible settings for the SIO2 port, I did get an entire memory card read down to 13 seconds, but you also seem to end up with stability issues with the console itself.
Dialing in the perfect combination of values for the best performance isn't really a priority right now, so I'm just going to leave it as defaults but it is something interesting to look into later (newer memory cards might have faster controller chips in addition to faster NAND, so there may even be a way to determine the best settings to use).
>>
>>
>>
>>
>>
>>
>>
>>
>>
File: 1753217004064225.png (332.1 KB)
I'm going to ask something very stupid. How much has C++ progressed on the web development front? It's not like it cannot be used to be hosted on mobile and on the internet in general like java and C#. I'm seeing all these bloated apps and I cannot help but wonder if C++ is the answer to that. Excuse me if I'm a little ignorant. I use C++ but always felt its web capabilities have been little at best, save for creating clients, servers, and browsers.
>>
>>
>>
>>
File: HJGCSGkWUAE6TJZ.jpg (59.6 KB)
I didn't want to post this on the lisp and Emacs general or the fglt because I don't want straight up biased answers, but I've been editor hopping a lot.
I really "love" Doom Emacs. I became very proficient at navigating files, I really like Org Mode and Org Roam and Org Agenda, editing shit just works, LSPs work, and all that, but sometimes it feels slow as fuck. Like sometimes I literally get very noticeable input delay when writing MARKDOWN.
I wish I was a normie that always used vscode or sublime text, sigh. Kinda want to force myself to go full normie mode and use vscode, except I feel like the shit puts too much pressure on my thinkpad and warms it considerably...
>>
>>108979395
i'm mostly editor agnostic but i sort of know vim keybinds. i still use the arrow keys too much when using vim. i wish i could be passionate about a particular set of programming tools but i am still surface-level with most of them despite having programmed for many years.
https://www.youtube.com/watch?v=Rys4B9_m6Gk
>>
>>
>>
>>
>>108979524
>and it took databases like MySQL *24 years* to *finally* support asynchronous submissions
>before that they would just block the thread
>enjoy your constant context switches and threat reschedulings
>>
>>
>>
>>
File: culture.jpg (36.7 KB)
>>108974739
>>108975496
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>108980438
Which sounds exhausting
>>108979497
Yeah don't do that. Just focus on programming and not on editors or linux distros
>>
>>
>>108980424
meh, happens
the trick is to not worry too much when it happens and to just get on with changing things to fix stuff
the more you practice, the quicker you spot problems and fix them, occasionally before you write code even
>>
>>
>>
>>
>>108981430
>you can write the worst userspace bullshit imaginable
>that means it scales
Holy retard.
>>108981465
A normal person would ask themselves if they haven't done enough damage already.
>>
>>
>>108973580
>mc
check out dual contouring, it's much better than marching cubes
https://www.cs.rice.edu/~jwarren/papers/dualcontour.pdf
>>
>>108981554
No. I didn't mention anything about users.
You might have clicked the wrong post.
In my case I'm incorporating feedback from a handful of users from different teams that have done calls and reviews independently with me.
They like the program as users but the consistent complaint is the complexity of the code, which I agree with.
I wanted something that worked first and I'm refactoring that into something that passes the bar over time.
Users are happy with the unintended performance gains as the code gets simpler / reduced.
>>
>>
>>
>>
>>
Autistic dude at my work made a shitty "get shit done" clone and stuffed it into the corporate CLI so it auto installs on everyone's machines. Piece of crap literally stops Claude 5-6 messages into a conversation.
Just put up a PR that ripped that shit out and he's crying about it now. I'm done playing with this fucker's toys.
>>
File: file.png (27.7 KB)
>>108976667
>emacs actually has an art mode you can use to draw with
No fucking way lmao. Literally this: https://xkcd.com/378/
>>
Autism inducing app, just save to a file and compile it with cl using the x64 Native Tools Command Prompt for VS. I.E.: cl overlay.cc
https://godbolt.org/z/T3dKWexTr
Bouncing logic:...
void tick(double delta) {
for (int j = 0; j < max; ++j)
for (int i = j + 1; i < max; ++i) {
const auto dx = px[i] - px[j];
const auto dy = py[i] - py[j];
const auto r = pr[i] + pr[j];
const auto rr = r * r;
const auto dd = dx * dx + dy * dy;
if (dd > rr) continue;
const auto dvx = vx[i] - vx[j];
const auto dvy = vy[i] - vy[j];
const auto nvn = dvx * dx + dvy * dy;
const auto nv = dd > 1 ? nvn / dd : nvn;
const auto nvx = dx * nv;
const auto nvy = dy * nv;
vx[i] -= nvx, vx[j] += nvx, vy[i] -= nvy, vy[j] += nvy;
if (dd < 1) {
const auto s = r * .1;
if (rng(3))
px[i] += s , px[j] -= s;
else
py[i] += s , py[j] -= s;
continue;
}
const auto s = (1. - dd / rr) * .1;
const auto sdx = s * dx;
px[i] += sdx, px[j] -= sdx;
const auto sdy = s * dy;
py[i] += sdy, py[j] -= sdy;
}
for (int i = 0; i < max; ++i) {
px[i] += vx[i] * delta, py[i] += vy[i] * delta;
if (px[i] < pr[i]) vx[i] = -vx[i], px[i] = pr[i];
if (py[i] < pr[i]) vy[i] = -vy[i], py[i] = pr[i];
if (px[i] > w - pr[i]) vx[i] = -vx[i], px[i] = w - pr[i];
if (py[i] > h - pr[i]) vy[i] = -vy[i], py[i] = h - pr[i];
}
}
...
>>
There are some functions where it would be beneficial to pass on the caller's file and line instead of using __FILE__ and __LINE__ in place. Is there some smarter way to do this without duplicating so much code and littering my codebase with preprocessor #ifs?# if defined (DEBUG)
# define Heap_Alloc(Heap, Size) Heap_Alloc((Heap), (Size), __FILE__, __LINE__)
function void* Heap_Alloc_(heap* Heap, size_t Size, const char* CallerFile, unsigned CallerLine) {
return Heap_Realloc(Heap, NULL, Size, CallerFile, CallerLine);
}
# else
function void* Heap_Alloc(heap* Heap, size_t Size) {
return Heap_Realloc(Heap, NULL, Size);
}
# endif
>>
>>
>>108982389
Why do you care? Just use Claude and focus on high level architecture (classes/functions, interfaces, high level systems with their own single responsibility, etc).
But yes, go with python for any math that's more complicated than basic arithmetic. You're going to have a much better time doing any linear algebra and python then javascript.
>>
>>
>>
>>108982584
Basically, I'm more or less motivated by websites even though I haven't opened Visual Code in years the AI can do it for you now? lol
I don't know if there's a project that would interest me with python, unless there's something cool and I'm kind of dumb to think about it
>>108982584
Let's say I learn Javascript like I can remember functions etc etc would python be much easier to learn, or vice verca
>>
>>108982349
__builtin_FILE is an option. in C++20 it's source location.
But to remove the parameter, you have trouble (unless you always keep this on, OR you replace the __builtin_FILE with nullptr which is a bit lazy).
tracking malloc isn't worthwhile because you have address sanitizer, and you have drmemory(windows) and valgrind(linux) (unlike asan, these will detect uninitialized memory use, but you wont detect invalid stack access and asan runs 1000x faster if you have a graphical library, also wont work in a debugger unlike asan).
the use of __FILE__ for me is typically for assert / check type messages. I have tried to use source location to add better contextual information (AKA moving the location down 1 frame), assuming that I don't have support for a stacktrace (C++23 <stacktrace>) / error reporting (bugsplat/sentry/app stores). But I think it's not worth it if you have the either working.
If you don't want to share the debug info, and you still want to check for asserts, you can use clang's __builtin_verbose_trap. On windows, clang (generating .pdb files) will not work because __builtin_verbose_trap is excluded from debug info, they fixed the bug, but the change has not reached the newest build, you need to build from source (.pdb files would be useful for error reporting tools + not sharing the debug info).
https://github.com/llvm/llvm-project/issues/195768
By the way if you create PDB files for release builds, you should enable /OPT:ICF since it's turned off, and to remove the path to your PDB file embedded in your binary you should set /PDBALTPATH:%_PDB%
On mingw verbose_trap should just work, but unfortunately C++23 <stacktrace> is not supported. And to print the trap you need a unhandled exception handler. Also I started using __builtin_unreachable (under a macro) for my default switch label when I want to shut up a linter warning, and with ubsan traps, I can get a trap using: -fsanitize-trap=unreachable or undefined and it will be a verbose_trap.
>>
>>
>>
>>
>>108982643
memory leaks are always false positives on valgrind / drmemory / asan, if you are doing anything with a graphics API, the nvidia driver always leaks, also one of the linux font libraries loaded by QT will leak as well.
it's not a leak, they will not fix it, if you were to attempt fixing the issue, it's likely you will turn a harmless leak into a invalid memory access error leading to a segfault during exit.
>>
>>108982625
I'm just using linux+gcc and C11 right now. I wrote a minimal heap implementation to separate myself from libc entirely for instances where it might not be available like WASM (and just for fun) and it just abuses a large mmap runway of virtual address space to basically go on forever (to some unreasonably large constraint) or a static slab of memory you feed it. I still want the asserts just to instantly find things like double frees because it's trivial to do so anyway and does not rely on any external tools or dependencies. I just wanted to cut down on duplication and boilerplate.
builtin_verbose_trap sounds nice, I wish gcc supported it
>>
>>
>>
>>108982686
>you will turn a harmless leak into a invalid memory access error leading to a segfault during exit
As it should. There's nothing that pisses me off more than crapware that needs me to close and restart it because it can't dismantle and rebuild its graphics pipeline.
>but then again nVidia's drivers were clearly written by incompetent buffoons with horrific braindamage
>like, would you expect retards to be able to fix your car, too?
>>
>>
>>
>>
>>
>>108983595
Not that this is a problem for you right now - but why reload values into registers that you know haven't changed? If, for example, EAX holds the FD and never changes (at least for some time), then it doesn't make sense to constantly write into the register.
That's something that C compilers constantly fuck up - they assume register values are completely volatile, even if THEY are the ones issuing the code and KNOW that to be not the case.
>>
File: 1780640374609502.png (112.7 KB)
>>108983674
After the syscall eax holds a return value.
In this case bytes read.
>>
File: 1780640638173959.png (48.7 KB)
>>108983674
Linux loves pounding registers like I pounded your mum last night.
>>
>>
>>
>>
>>
>>
>>
File: 1780652896349459.png (36.3 KB)
>>108983741
mov rax, rax is ignore by the cpu.
They'll just have to be general purpose macros, there's no need to sperg out over this.
>>
File: compilers_are_garbage_static_access_2.png (158.3 KB)
>>108984471
>there's no need to sperg out over this.
A-huh.
>>
>>
>>
Need
The 'team' including normie foids and my foid manager want to have a team lunch. How do I tell them that I don't like having photos taken without sounding too autistic? They always take photos and share it with the entire company. I'd tell them to fuck off but I'm due for a promotion soon and don't want to jeapordize it.
>>
>>
>>
>you're sperging
Nah, I'm creating priority lists.
Compilers are highly efficient at code generation, so you should look at the sections where they're NOT. And reloading values into registers is one such area.
>I'm going back to using div
OK, autist.
>>
File: 1750959948108085.jpg (19.8 KB)
i dont even code outside of sloppa genning but i come to this general literally only to throw peanuts at the mega autist who screeches about factorio, the most autistic game ever known to man aside from maybe like fucking openTTD
his new arc of calling other people autistic and implying that he isn't one is pure unadulterated KINO, nigga is obsessed with the inefficiencies of I/O of a fucking minecraft mod inspired (!!AUTISM!!) game about simulating an efficient factory (AUTISM2: THE REVENGE OF THE SONIC OC, LEGO EDITION)
i can only pray to god that the autism beams between the newly growing assembly autist clashes harder with the factorioschizo autism
>>
>>
>>
>>
>>
File: 1764217549349603.png (6.8 KB)
>>108984696
hahaha look at this fuckin kino man i swear to god it's the shit that heals my soul
he even did that where he doesn't quote me because he thinks i'm not going to understand that it isn't directed at me, like an autistic child putting garbage under the bed because it no longer being in his vision means it's "gone"
i get that for you guys he might be a pest since you want to like actually talk about programming (although i've never seen a github or pastebin link here so you're probably all as larpy as me), but this shit after a dozen agony inducing ranked games just causes all the worries of life to go *poof*
thank god i never touched factorio or coding, i might have ended up like this dude or a troon
>>
>>
File: autists_and_their_enablers_were_never_human_beings.png (60.3 KB)
>the autists thinks I care enough to read the entirety of his autism
Sorry, but ADHD. If you cannot be interesting in the first line I'm just sending you off to be turned into food and call it a day.
>Avoiding div
If you think that you are so autistic that not even the pigs want to have a bite of you. Like, you're so toxic that humanity is better off turning you into fuel rather than food.
>>
>>108984752
Calm down freak.
https://www.youtube.com/watch?v=tG66j1sP8gs
>>
>>
>>108984752
I have ADHD and I read that, it isn't hard, you remind me of the retards in high school who would pretend to have ADHD for attention while also calling me a retard because I had discalcula because of ADHD
>>
>>
>>
>>108984894
Sorry I didn't read that, ADHD :^)
https://www.youtube.com/watch?v=kkr25YRUCnM
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>