[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1726700182975.jpg (395 KB, 1080x1513)
395 KB
395 KB JPG
Welcome to the Daily Programming Thread. What are you working on, /g/?
Previous Thread: >>102403295
>>
dlangs future is looking bright lads
nogc phobos 3 on the way, and a new, modern GC
>>
>>102448954
>GC
Never understood this concept as a C-chad. Why don't you just cleanup your own shit?
>>
sometimes you just want to write a tiny script or program and don't really care or need to think about resources that will just get reclaimed anyway
>>
Then just use exit() as the GC.
>>
you still have to alloc and set things up in C which wastes time.
>>
Use the stack
>>
not always feasible or nearly as convenient
>>
>>102448954
What a great image. Where is this from?
>>
>>102448954
haha she's holding a 3D printed save icon
>>
>>102449360
zoomer pls
>>
File: 4tran.jpg (197 KB, 999x1003)
197 KB
197 KB JPG
there should be more memes about this

also, i think i just cracked my egg :/
>>
>>102448954
if you assholes would just keep it bare metal and code a single executable that builds and
detroys and builds again the things people really want at that moment right fucking there
and then, we wouldnt found ourselves in the middle of this shitshow, wouldnt we?
>inb4 too complex
K I L L Y O U R S E L F
you imbecilic fucks couldnt figure that problems dont get complex, they just need a
new perspective, but no, you HAD to make everything a fucking mess fuck you.
>>
>>102449360
1.44 MB of storage, baby.
>>
>>102449285
@MattChuUK. It turned up on an image search.
>>
File: works_like_a_charm.png (27 KB, 6288x320)
27 KB
27 KB PNG
>>102449582
>it won't work
How does it not work? I have 64 GiB on this machine and absolutely no issues reserving (not committing) 128 GiB:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main(void)
{
void*ptr = VirtualAlloc(NULL,128 * 1024 * 1024 * 1024ULL,MEM_RESERVE,PAGE_READWRITE);
DWORD e;
printf("%p|%u\n",ptr,e);
Sleep(15 * 1000);
VirtualFree(ptr,0,MEM_RELEASE);
return 0;
}


And the mapping goes through without a hitch, see picrel.
>>
https://sharetext.io/?slug=19909b8d
>Maintainers Summit
this kills the crab
>>
>>102449775
Forgot the GetLastError() there:
DWORD e = GetLastError();

But it really makes no difference.
>>
Auditing a Algorithms Course in Java after finishing an Intro to Programming course.

Was also thinking of trying to create a terminal app to read / access my email. Again in Java.
I've heard Go is really nice for TUI apps but I think I should just stick to one language at a time
>>
>>102449083
Concurrency is too important in modern computing which increases the risk of null dereferencing from some sort of data race or strange sync issue somewhere. Realistically garbage collection is semi pointless, but it's not as Satan tier as implied.
>>
File: err.png (47 KB, 735x462)
47 KB
47 KB PNG
>>102449775
try writing into the memory.
for me it just crashes. Maybe i'm retarded.
https://godbolt.org/z/7Prbx6esq
If I set to MEM_COMMIT it works.
I thought it was address sanitizer due to not testing withou it, but no you just can't use MEM_RESERVE without the exception handler approach or something.
>>
>>102450179
does 4*1024ULL cause any weird overflow
>>
>>102450179
>try writing into the memory.
That's not gonna work.

Why? Because the virtual address space is not backed up by anything. Again, Windows doesn't do auto-commit - that's the entire point of the pattern. Reserve large, then commit in chunks.
>>
>>102450124
concurrency is bad actually, buy a faster cpu
>>
File: parallels.png (17 KB, 800x950)
17 KB
17 KB PNG
>>102450324
And pay Intel through the nose for collapsing CPUs? You're funny.
>>
File: file.png (22 KB, 865x220)
22 KB
22 KB PNG
do you pronounce the "ch" in char as in "car" or as in "chair"?
>>
>>102450954
How do you pronounce "character"?
There's your answer.
>>
File: 1726715737802.jpg (12 KB, 480x360)
12 KB
12 KB JPG
>>102448954
HACK THE PLANEEEET
>>
>>102450954
I flip a coin in the morning to decide
>>
what do we think about meta languages, /dpt/?
>>
File: memcpy.png (11 KB, 460x778)
11 KB
11 KB PNG
>>102449083
Because brainlets are afraid of learning how memory works in the first place, and that includes a lot of C-chads which never go beyond malloc/free. They automatically assume that the people who wrote the allocators were omniscient demigods who optimized the code for their specific usecase, completely ignoring that the demigods' job was to write a generic allocator with an even more generic interface, and that they couldn't possibly know what usecases it would actually encounter.

And then you look at the code and realize that a lot of it is completely overblown garbage, and that a 150 LOC implementation would've been more than sufficient on top of running thrice as fast.
It's the bloody same with memcpy too, where people don't even realize that the promise to not overread and overwrite causes slowdowns.
>>
>>102451948
i guess actually the correct term for what i'm referring to is IDL
>>
>>102451948
>we
Learn to think for yourself, NPC.
>>
>>102451983
i love them. i am kind of hyper-fixated on them atm. i was just curious about other people's opinions. just making conversation
>>
File: generator.png (13 KB, 494x1000)
13 KB
13 KB PNG
>>102451990
Real programmers use perl and the preprocessor.
>>
File: 1714062344655930.png (469 KB, 943x720)
469 KB
469 KB PNG
>>102452012
for me, it's AIDL
>>
>>102448954
from langchain_community.llms import Ollama
llm = Ollama(model="gemma2")
llm.invoke("Why is the sky blue?")


from llama_index.llms.ollama import Ollama
llm = Ollama(model="gemma2")
llm.complete("Why is the sky blue?")

how do I use langchain and llama index on my raspberry pi 4 8gb? I installed Ollama just fine and it runs but I don't see anywhere it explaining how to install those two things, is it some pip package?
>>
File: image.png (6 KB, 590x59)
6 KB
6 KB PNG
>>102428193
>>102443696
After more testing I found this bug wasn't specific to gimp and happened when setting the folder data in the dialog. I was able to fix it with pic rel in gtk_dialog_run(). I have no idea why this works or why it needs to update 15 times exactly. This solution is so bad it almost bugs me as much as the bug itself.
>>
>>102450954
chair always. "car" sounds fucking retarded
>>
>>102451990
i like them but the non-lisp ones they tend to go a bit weird
one day i'll get around to writing a clang plugin that grants access to the compiler and clang interpreter at compile time
>>
File: W.png (688 KB, 800x600)
688 KB
688 KB PNG
I'm thinking on writing a server that has its own template language as an exercise, I want it to be monolithic but able handle heavy loads, it would be mainly used as a game agnostic live system (with chat features/friend requests) to use with its own client, but realistically it could be able to do anything you set it up to do.
The client would be able to parse the template language and render it like a game menu, so to speak.
Still, I'm unsure of the language to use for the server, I want it to be a learning experience so I'm willing to take up a new language for it, but it has to be the right tool for the job.
Any recommendations?
>>
File: 1706739664618485.gif (1019 KB, 500x281)
1019 KB
1019 KB GIF
I feel like working in tech for 7 years has made me dull. I'm on sick leave and trying to work on a hobby project that (surprise) is 1000x more complex than anything I do at work. My head hurts and I just don't understand. I wasn't like this when I graduated, I was actually able to figure out this kind of shit back then. Fuck.
>>
File: 1618954385967.jpg (107 KB, 492x492)
107 KB
107 KB JPG
>start project
>see obvious trap looming in the distance
>tell myself to make sure to skip it
>fast forward
>spend entire night debugging a nasty bug
>turns out I triggered the trap
At least now I know how dumb Dumbledore felt at the end of book five.
>>
>>102448954
I'm working on an application-layer network protocol that will be more verbose than all competing protocols
>>
>>102453202
Damn that's a nice way to say "it will be less performant than any competing protocols".
>>
>>102453252
That's the point, every message will have a sha-512 hash of the canonical form of itself (they're not transmitted in the canonical form on wire, so you have to convert), there will be a random amount (from 1 to 256) of random bytes, which must not be reused, etc
>>
>>102453292
What makes you think anyone will use it?
>>
>>102453309
I will use it
>>
File: 1359958293013.jpg (228 KB, 850x1203)
228 KB
228 KB JPG
Yay another esoteric arm 32 problem!

I'm having a problem where if I statically link libc to a large-ish program, then the linker inserts incorrect function pointers into the table of "ifunc" resolver functions that runs before main. There's two functions in the table, memchr_ifunc and memcpy_ifunc. Both functions are thumb, so their addresses should be offset by 1, however when and only when I link against this certain large executable, the damn linker is inserting the actual addresses without the thumb signal bit flipped. This has the effect of causing the program to crash with illegal instruction exception before reaching main, as it tries to interpret the thumb code as if it was arm code. When linking against a test program using the exact same command line arguments, it correctly flips the 1 bit and the ifuncs run as normal. Since I haven't been able to get a reproduction of the bug yet (it only happens with the big program), my only guess is that it has something to do with the location of the libc functions, like if they end up too far away from the beginning of the program or something then it mysteriously decides to drop that 1 bit. Looking at readelf output of a working program vs. the broken program I cannot see anything different. The ifuncs addresses in the symbol table are correctly offset by 1 in both cases. It's just the actual data in the table that's fucked up. I opened the broken program with a hex editor and flipped the two missing bits and it works.

Anyone have any clue about this one?
>>
>>102453556
Why bother designing a new protocol only you will use, when you can communicate with the voices in your head directly? Seems flamboyant.
>>
>>102453193
I've done this before lol
>>
>>102453592
I mean Google sold Flatbuffers to people somehow, even though it's not a protocol
>>
File: Swift_logo.svg.png (26 KB, 1024x319)
26 KB
26 KB PNG
Is Swift worth learning? It seems to be a bit like Go but it produces much smaller binaries

>Write a hello world program in Go
>It doesn't compile that quickly
>It requires boilerplate like 'import "fmt"' and 'func main'
>The binary is 2.1 MB

>Write a hello world program in Swift
>It compiles much quicker
>It requires no boilerplate, it's literally just 'print("Hello world")'
>The binary is 73 KB
>>
>>102453731
>Write a hello world program in Batch
>literally just 'echo Hello world'
>literally zero compilation time - there's no compilation
>the script is so small it has to be padded to the filesystem's smallest cluster size
>>
>>102453758
>Write the hello world programming language
>Literally accepts any file and just prints 'Hello world'
>Literally zero compilation - there's no compilation
>The script can literally just be an empty file
>>
>>102453817
now you're overdoing it
the point is, "hello world" is not a good benchmark for programming languages
>>
>>102453587
>Looking at readelf output of a working program vs. the broken program I cannot see anything different.
upload them somewhere and let us take a look
>>
>>102453758
>>102453887
I'm just trying out Swift, writing a couple of classes and stuff like that, and the binaries are pretty small. But Go binaries are quite large, I think they are always a couple of megabytes or more.

But yeah maybe when you write a proper program where you're importing several packages and whatever, maybe the resulting binaries would be similar sizes, I dunno.
>>
>>102453731
binary size is by far the single most idiotic metric you could use for anything, stop being fucking stupid and think for a single second
you aren't targeting an embedded architecture from 20 years ago it doesn't matter
and for the record iirc swift pulls in a fuckload of shared libraries on top of the system libs for support, and despite this i'm pretty sure you still need GNUStep swift to get anything actually done in terms of cross platform application development
while iirc go has its own equivalent to libc

also i would not trust apple developers with anything while i think as long as google has a good team of tard wranglers in charge of steering go it will probably still stay consistent (which may well change) and well maintained
>>
>>102453817
>Write hello-world.txt
>The binary is 11 bytes
>>
>>102454037
>lowercase i
>expects to be taken seriously
>>
>>102454053
apple related technologies aren't worth effortposting
>>
>>102454037
Your post only makes sense to fucking morons. Of course a fucking moron like you would write this.
>>
File: 2024-09-19_swift-poster.png (132 KB, 1920x1040)
132 KB
132 KB PNG
>>102453731
Is it worth reconsidering your life choices?
Maybe you should reconsider your life choices.
>>
>>102453969

ive heard Go tries to cover multiple platforms, thats why its big. have to measure dependencies to be sure

>>102454037

Go targets only modern systems, its "compiler" doesn run on win7 for example, soon it wont run on win10. but sooner it will be abandoned like hyperthreading, because it adopted fibers

binary size is a great measurement, most of compilers have an option to reduce it

>>102453758

yes, that is the power of high-level languages, though batch isnt general purpose, there are better candidates guess yourself
>>
File: 1365187407592.jpg (536 KB, 890x890)
536 KB
536 KB JPG
>>102453952
Here's what I think are the relevant bits from readelf:
https://pastebin.com/sgNNCWqU

Here's printing the addresses in the table right at the start of the program with gdb:

// working program

0x00010510 in _start ()
(gdb) p/x *(unsigned*)0x10158
$2 = 0x74010
(gdb) p/x *(unsigned*)0x74010
$3 = 0x2cdb5

// broken program

0x000363c8 in _start ()
(gdb) p/x *(unsigned*)0x10158
$1 = 0x49cc010
(gdb) p/x *(unsigned*)0x49cc010
$2 = 0x40a7798


As you can see the working program has function ptr 0x2cdb5 at offset 0x74010 from the table, which matches up with the address of memchr_ifunc in the pastebin. However, the broken program has 0x40a7798, which is missing the 1 bit compared to the address in the pastebin of memcpy_ifunc. (The same is true for each other function in each binary, both are correct in the working program and both are broken in the broken program. The order they end up in the table seems kind of random and changes sometimes on recompilation, so I don't think it's related.)

The relevant source from the c runtime where it iterates this table:
https://github.com/lattera/glibc/blob/master/csu/libc-start.c

# elif defined ELF_MACHINE_IREL
# define IREL_T ElfW(Rel)
# define IPLT_START __rel_iplt_start
# define IPLT_END __rel_iplt_end
# define IREL elf_irel

.......

extern const IREL_T IPLT_START[] __attribute__ ((weak));
extern const IREL_T IPLT_END[] __attribute__ ((weak));
for (const IREL_T *ipltent = IPLT_START; ipltent < IPLT_END; ++ipltent)
IREL (ipltent);


The crash is after it tries to call the pointer with the missing thumb bit in "elf_ifunc_invoke" here:
https://github.com/lattera/glibc/blob/master/sysdeps/arm/dl-irel.h
>>
>>102454140
Oh my God TWO THREADS?!

>>102454167
>ive heard Go tries to cover multiple platforms, thats why its big
Cross-compiling with Go for different platforms is incredibly easy but the resulting binary will only work on one platform, I'm pretty sure.
>>
>>102454219
have you tried compiling with -fno-pie/-no-pie
>>
>>102453113
this is sad but interesting. i would've thought more experience, doing this pretty much every day would improve your skills. why do you think working has made you dull?
>>
>>102454090
whining child
code golfing down to the smallest number and size of instructions is really idiotic, execution speed is literally the only thing that matters
code size doesn't matter, binary size doesn't matter, suckless are retarded

especially since you're comparing a language which primarily uses static linkage and something which pulls in fucktons of support shared libraries
you wanna compare binary size, compare your swift program + all non-system provided runtimes, because that's what's actually going to be installed
and i don't think apple even actually properly ported the swift runtime libraries other OSes, bugs in some, others just missing, that's one of the reasons GNUStep exists

now go's focus on static linkage only would normally be a negative kind of like rust but since it has very fast compilation times, and depends only on its version of libc and system calls (although apparently there's some way it can still use system libcs) it's much more portable
also guess what compiler backend swift uses
llvm, although in my opinion architecturally well designed from a library perspective is infamous for being slow
swift is not going to compile faster than go in the real world
>>
Haven't coded in a while and when I used to it was mostly in C and Java.
I have been wanting to get back into it all again - what is a good programming lang rn? I want something familiar and powerful like C but Java's memory management has spoiled me.
Any suggestions?
>>
>>102454284
Well I've been doing mostly high level stuff like being a cloud architect or a web backend developer, at work. Its consequence is that I've forgotten quite a bit of math and other stuff that truly interest me, because I haven't had energy to work on hobby projects on my spare time. So I kinda feel like all this useless k8s/aws/azure/whatever bullshit knowledge I've acquired at work over the years has partially overwritten my vector/matrix math/low level programming knowledge I've acquired before I entered the work life.

Don't get me wrong I am far more better now at actual software design and software testing. But those principles are just trivial by itself when compared to problems you face in 3d rendering / games / dsp...
>>
>>102454220

X = A+B+A+B+A.. (interleave, then exclude upon compilation, like with those #ifdef)

X = Y ~ A+A+A+A+A+A (((or))) B+B+B+B+B

where Y is additional abstraction layer that always takes some space, Go is probably second variant, you use abstracted API not system API
>>
>>102454340
Like C but with memory management sounds like Go.
Other alternative to C are Zig and Odin.
And because you mentioned Java: C# is Microsoft Java with blackjack and hookers.
>>
>>102454337
You're a moron. Executable size does matter for machines that don't have much storage, like a Raspberry Pi or something.
>>
>>102454276
Doesn't seem to make a difference, which I guess makes sense since the problem is between the linker and the already compiled libc.a.
>>
>>102454665
(to be fair I didn't rebuild the whole program just one file and then redid the final link step, but since the problem happens before main it shouldn't matter I think)
>>
>>102454608
no, executable size matters for machines that have such small amounts of RAM you have to carve out parts of system code for more space like a TI-84 calculator
a raspberry pi is not actually an embedded target, it's a small form factor PC
>>
>>102454674
>since the problem happens before main it shouldn't matter I think
it does
the whole binary needs to be pie
turning off vectorization may also help
>>
>>102454755
*non-pie
>>
>>102454716
also lmao
>not a lot of storage
after checking to confirm that it does in fact primarily use SD cards this is such a fucking insane claim to make
i have 3 128 gigabyte samsung micro SD cards just lying around i bought on a whim because they were cheap
they're currently my make do backup solution
>>
>>102454716
>a raspberry pi is not actually an embedded target
I didn't claim it was. Anyway, the GitHub CLI for example is written in Go and the executable is 48 MB on my machine. In other languages I bet it would be way smaller. Sure it's not as bad as Electron apps which are like 400 - 500 MB but still, Go binaries seem to be significantly larger than C or Swift binaries for programs that do the same thing.
>>
>>102454761
I know that the whole program should be compiled with the same setting of the pie/pic flag. What I meant was it seems unrelated to this specific issue. Same with vectorization. This is a problem with linking not code gen. I'm looking at this file: https://github.com/bminor/binutils-gdb/blob/master/bfd/elf32-arm.c
and I can see they shave off the 1 bit here:
      if (dst->st_value & 1)
{
dst->st_value &= ~(bfd_vma) 1;
ARM_SET_SYM_BRANCH_TYPE (dst->st_target_internal,
ST_BRANCH_TO_THUMB);
}

As there's a lot of switching around of ST_BRANCH_TO_THUMB and ST_BRANCH_TO_ARM in this file, some of which seems to be related to jump distance/offset size (which matches the behavior I'm seeing where this only happens on a big binary), my guess is there's some combination of offset size/flags/whatever that causes this to end up as ST_BRANCH_TO_ARM but fail to be aimed at a stub or whatever and still point at the original address with the 1 bit masked off. For all I know it might even be fixed already and the linker I'm using is just old. This sounds vaguely similar: https://github.com/bminor/binutils-gdb/commit/a747a286b9331adfba85a508beddaef47ea1a1c2

I'm not so much interested in finding a way to make the program run (after all, I can manually flip the two missing bits with a hex editor and the program will work then, it would be trivial to write a script to do this), I'm more just curious to find the cause of the bug and whether or not it's known/fixed.
>>
How do niggas actually find programming fun? People actually spend their free time programming. Nigga wtf are you programming in your free time? The matrix? Go outside and talk to a girl, start a family. Go into the wilderness. Instead niggas rather be in front of a screen all day. I will never program in my free time, fuckkkkk that.
>>
>>102454915
See for example this mess:
      /* Handle cases where:
- this call goes too far (different Thumb/Thumb2 max
distance)
- it's a Thumb->Arm call and blx is not available, or it's a
Thumb->Arm branch (not bl). A stub is needed in this case,
but only if this call is not through a PLT entry. Indeed,
PLT stubs handle mode switching already.
*/
if ((!thumb2
&& (branch_offset > THM_MAX_FWD_BRANCH_OFFSET
|| (branch_offset < THM_MAX_BWD_BRANCH_OFFSET)))
|| (thumb2
&& (branch_offset > THM2_MAX_FWD_BRANCH_OFFSET
|| (branch_offset < THM2_MAX_BWD_BRANCH_OFFSET)))
|| (thumb2
&& (branch_offset > THM2_MAX_FWD_COND_BRANCH_OFFSET
|| (branch_offset < THM2_MAX_BWD_COND_BRANCH_OFFSET))
&& (r_type == R_ARM_THM_JUMP19))
|| (branch_type == ST_BRANCH_TO_ARM
&& (((r_type == R_ARM_THM_CALL
|| r_type == R_ARM_THM_TLS_CALL) && !globals->use_blx)
|| (r_type == R_ARM_THM_JUMP24)
|| (r_type == R_ARM_THM_JUMP19))
&& !use_plt))
{
.....

You know there's gotta be a bug or two hiding in there.
>>
>>102454601
I have some experience with C# and ASP.NET - mainly project to pass the course, but although the syntax is better - I won't code in it. Idk it just gives me an ick.
Go, Zig and Odin - can I make GUi programs and scripts with it?
>>
>>102454755
>>102454915
>>102454949
Confirmed that -fuse-ld=gold fixes the issue, so yeah it's a bug in the bfd linker (probably in the file I linked) and may or may not already be fixed, since the arm 32 gcc package that installs on my pi is version 12 which is a little old. I suspect I could get this to reproduce by creating an artificially large code section and then linking libc after it, then I guess one could test against the latest version/submit a bug report/etc., but that's more work than I'm willing to do right now. At least I know it's not a problem with my build.
>>
>>102450021
if you are doing well, i would recommend working in Go if only to escape the clutches of java.
>>
>>102455011
>Can I make GUI programs with it?
Notoriously, no: You'll need something else to do the GUI side of things.

>Can I make scripts with it?
Surprisingly, sort of: Go does bill itself halfway as a scripting language.
But honestly, I see little reason, not to use a compiled language.
Hell, I even once wrote a Powershell script for compiling small C# programs using Windows'
inbuilt C# 5 compiler into the temp folder, running them, and deleting them on completion.
When you can do that, why not just use a compiled language?
>>
>>102455278
I don't mind using a bash script to do it honestly. I am confident that I hack a solution for my usecase. But if there is some support for it in-built: then it would make it easier for me - perhaps.
idk
>>
File: 1726724055513931.png (13 KB, 598x206)
13 KB
13 KB PNG
>>102454945
Thanks for advertising your mediocrity, I guess?
>>
>>102455507
Snowden is so up himself it's ridiculous

He's like those people in that South Park episode who sniff their own farts
>>
>>102455635
>shooting the messenger
I accept your concession.
>>
>>102455210
I really do have Go on my todo list, especially Effective Go and the Lets Go Book by Alex Edwards.

Is that still the standard way to learn Go or do you have other reccs for a newb
>>
>>102455652
I'm not the guy you were replying to

Look at that tweet, he thinks he's amazing and everybody else is a shitty pleb, what a twat he is
>>
>>102455721
That's because he's not mediocre, unlike you.
>>
>>102453587
what compiler are you using?
>>
>>102451048
i pronounce it "care-ACK!-ter", but pronouncing it as "care" sounds weird
>>102451590
based
>>102452237
i guess there's actually more ways to pronounce it:
>same as care
>same as car
>same as chair
>the way you pronounce char when talking about cooking
>>
>>102455731
He's a moron who was desperate to be famous, completely up his own arse, just like you
>>
>>102456054
And yet he's going to be more rich and more famous than you'll ever be. Just imagine how many people would come to his funeral, compared to yours.
>>
>>102455988
This one:

/usr/bin/arm-linux-gnueabihf-g++

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/12/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a+fp --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)


It's the one that gets installed when you type "sudo apt install g++-arm-linux-gnueabihf" on raspberry pi 5 with the standard OS. What I want is to be able to use this pi 5 as a testing box for both 64 bit and 32 bit arm code, but I keep running into random problems with the 32 bit support (some of which I've already blogged about in /dpt/).

Anyway, I figured this one out (more or less) see:
>>102454915
>>102454949
>>102455151
>>
>>102448954
such amazing face ruined by short hair
>>
>>102450954
Like "charcoal".
>>
>>102455667
NTA

>Effective Go
Do you mean https://go.dev/doc/effective_go or Effective Go Recipes?
Either way, I really enjoyed Effective Java, so hearing something called Effective Go piques my interest.
>>
I'm learning Rust with Rustlings. it doesn't seem that hard.
>>
Usecase of labels being scope-based?
I am not talking about function-base, scope-base
>>
File: direct_redirection.png (40 KB, 880x496)
40 KB
40 KB PNG
So how likely is it that this will break at some point in the future? 32-bit support is not a concern, and as long as I have 8 bytes worth of padding that I can use to store a function pointer I should be good. If anything MS would only ever increase the alignment size, wouldn't they?
>>
File: file.png (16 KB, 519x271)
16 KB
16 KB PNG
i've recently adopted the practice of alignment formatting long list entries
i must say it looks very clean
>>
>>102456095
So you admit the only reason he publicised the PRISM stuff was for his own pursuit of fame and wealth. Lol.

As for funerals, that's really not something I care about. I'd rather achieve the things I want to achieve in life even if nobody comes to my funeral.
>>
which is convention is better?
resource::image::ImageColorType

or
resource::image::ColorType

I think having 'Image' as enum prefix is redundant because it's in the image namespace. but idk.
>>
>>102456865
There's a vim plugin for making this easier if you care enough.
https://github.com/junegunn/vim-easy-align
>>
>>102456996
>So you admit the only reason
Holy projection, Batman!
>>
>>102457061
nta but I do !column -t
>>
>>102457024
The latter if it's an enum class definitely
>>
>>102457198
what a strange larp this is
>>
>>102457293
??
>>
>>102456318
The former. Its the official docs and shows you the 'go way' to do things
>>
>>102457024
seconding the other anon, latter if it's an enum class otherwise i just keep the C naming conventions since the namespace winds up basically being the type name in my eyes
except if it's a flag then I use the vulkan naming conventions on an enum class, a wrapper type, and C++20 using enum
had to add it to the vulkan C++ header generator because for some reason the committee decided using enum doesn't work on dependent types otherwise i use a macro
>>
>>102456865
>she's still just editing text
>instead of dynamically transforming her code into html tables and performing high-level structural editing operations on them
ngmi
>>
>>102457565
a class enum member is incompatible with integer types in C++
We have talked about this bfore
>>
    auto buffer = std::make_shared<std::vector<byte>>(size_data.header_size);
for (auto& doc_write : documents) {
uint64_t& doc_size = sk::bytes_makeone<uint64_t>(*buffer);
std::span<byte> write_span = doc_write.write_append(*buffer);
doc_size = write_span.size_bytes();
}
>>
>>102457613
enum class enum_class_type : underlying_integer_t{};
using uniform initialization you can construct them directly from said integer type, and the standard provides std::to_underlying, and iirc they're safe to alias even under stict aliasing rules, std::byte definitely is (not to mention it doesn't matter if the standard defines them as aliasable, every compiler of consequence treats them as such)

they don't implicitly default to int if a backing integer width is not specified like in C but this is stupid behavior
>>
>>102457613
>a class enum member is incompatible with integer types in C++
what does this have to do with how you name them?
>>
>>102457594
I also used Scratch when starting out sister
>>
>>102457627
std::vector<byte> buffer(size_data.header_size);
uint64_t doc_size = 0;

for(auto& doc : documents)
doc_size += doc.write_append(buffer.data());
>>
>>102457808
ignore the buffer.data(), just pass buffer directly i didn't realize how it worked
>>
File: 1706248839299406.jpg (230 KB, 1920x1080)
230 KB
230 KB JPG
>>102451576
>>
My one regret is that I won't have enough time on this Earth to master every programming language
>>
>>102457902
Don't feel regret. Most of it is complete garbage.
>>
>>102456672
Also I've just stumbled upon https://lwn.net/Articles/826313/:
>As a reminder, the intent of this work is to enable the running of Windows binaries that call directly into the Windows kernel without going through the Windows API.
Correct me if I'm wrong, but aren't syscall numbers subject to change and require ntdll.dll and ntoskrnl.exe to be compatible to one another? What crazy software would make changes to the SSDT like that?
>>
>>102458103
Most of anything is complete garbage, that doesn't mean that there isn't a lot of wonderful stuff :)
>>
>>102458271
I haven't tried calling them directly myself, but I have referred to this table before when debugging Windows shit: https://j00ru.vexillium.org/syscalls/nt/64/
As you can see they do indeed seem to change sometimes with updoots and so forth.
>>
>>102458431
I don't mind them changing - in fact that's what I'm relying on. Turns out that module-internal calls don't go through the IAT (shocker, I know), and I need to go deeper. But if applications can trigger syscalls just like that, then I need to start trapping syscalls in userspace, and I have no idea how to do that.
>>
>tries to research a stack overflow
>google sends me to the main page of stackoverflow.com
>>
>need to write a cross platform app
>don't want pay qt license
>would rather avoid react-native
already out of options... GUI development fucking sucks
>>
>>102458686
Join us now and share the software. You'll be free, hacker, you'll be free.
>>
>have a data structure
>every field must be aligned to an address that is a multiple of the size of the field data type
>need to reorder the fields to end up with minimum padding size
What's the algorithm to reorder the fields to achieve this? It also needs to arrive at the same result from the same input every time.
>>
>>102458686
GLFW + OpenGL
>>
>>102458795
yeah the platform support doesn't seem too good
>>
>>102458686
isn't QT available under LGPL? thats free & u dont even have to share the source code of your own program, just any modifications you make to the QT library itself
>>
>>102457902
When you realize how stupid "learning programming languages" is as a problem statement then you might have finally learned programming
>>
>>102458873
you can't dynamically link on ios
>>
>>102458825
You're making an app that runs on desktop and mobile at the same time?
>>
>>102458985
>doesn't understand what cross platform app means
peak programming board
>>
File: flutter.png (380 KB, 1920x1043)
380 KB
380 KB PNG
>>102458686
unless you need multiple windows in the desktop client or BSD support, you could use Flutter
>>
>>102456142
>>102448954
>>102449285
>>102451576

Hackers Angelina Jolie was peak Angelina.
>>
>>102459120
>Flutter
google is going to kill it in two weeks like all their projects
>>
>>102458925
oh
TIL you have to provide a mechanism for the user to change the dynamic libraries your applications links with or else you are in breach of the LGPL 3

I'm pretty sure no apps actually do this tho (neither android or IOS provides a mechanism to change libraries) so does this mean pretty much every mobile app is in breach? Can i sue them for money?

Any legalfags in here? im genuinely curious
>>
>>102459228
if the app developer uses qt libraries, I think qt needs to sue, which I hear they actually do threaten people.
>>
>>102459174
It's astonishing how beautiful she was then.
>>
>>102459255
damn the more i learn about open source the more snakey it seems
>>
>>102458825
you're just asking for trouble
>>
>>102453193
Hah. I immediately abandon the project after step 2.
>>
>>102458686
Would a webpage as a frontend do?
That's what my company does for every project...

>>102458744
Just order largest to smallest.
Break stalemates with ASCII ordering.

>>102458825
Well, how cross-platform does it need to be?
What platforms are being targeted?
>>
>>102459197
nta but it's actually pretty good. It's mostly for mobile dev but it works well on desktop. It's literally the only thing that keeps Dart relevant for Google.
>>
File: wcf.jpg (22 KB, 786x445)
22 KB
22 KB JPG
Why does my async delegate cause the WCF to freeze when it's searching? I have a progress bar and a status label to say "Starting Search..." when the search is in progress, but it doesn't show any of them and simply freezes until the search is done. I've been trying to fix this for two weeks. Please help.
Full code for client:
https://pastebin.com/tdxTWT8C
>>
>>102460056
by wcf, i meant windows form application
>>
>>102460056
Are you running it on the GUI thread?
I forget what the exact mechanism is called but there's a way to run tasks in the background on a separate thread to avoid freezing the UI in WPF/WinForms
>>
>>102460192
It's a Dispatcher
>>
>>102454037
>you aren't targeting an embedded architecture from 20 years ago it doesn't matter
working set size matters even now because being cache friendly is a very good plan
the less pressure you put on cache, the more likely your code will go at full speed and not be booted out by something else
>>
>>102458686
You're finally seeing the truth. There IS no programming except web development or games. That's it. There's nothing else. Pick one. UI applications is just 90s, it doesn't exist now. Even VSCode? That's a web app. All the apps you think are applications are just web apps and you don't even realize it.
>>
>>102459174
nah tourist one was better
>>
>>102456865
Doesn't look like VSCode, but if it is you can do that easy by column select mode. I always did it this way because PS1 game developers always did. PS1 game devs also always made little headers in comments, like:

/*===========================
*
* Service
* Getters and setters
*
* Author...CJ White
*
*==============================*/


Or whatever. So I always do that too.
>>
>>102461330
>There IS no programming except web development or games. That's it.
There's a lot of backend server stuff too.
You're right that GUIs are more niche than they were. Still crop up a lot in some types of embedded system. Not very sexy, but a lot of devices need them.
>>
>>102458686
QT is free to use if you follow the LGPL license.
>mobile Tivoization due to signing the code or whatever.
Use QT 5.6 for LGPLv2, or just supply a android/ios binary that lets people compile the app with a different version of QT.
Also I don't think mobile actually violates the tivoization rules, I'm pretty sure you can argue that people can extract the app and replace the QT binaries.
Web is the way to go for mobile support, you don't need to give a 30% cut to apple and android if it's on the web.
>>
Is ProjectedFS the closest thing Windows has to FUSE?
>>
>>102461424
I can't use C++ for my backend server without making API calls using raw rest calls. The exception is amazon AWS, they have a C++ SDK.
I like oracle because the price for bandwidth is cheap (as long as you stay in the generous free limits), but I may be incorrect I haven't really done a deep dive into the real cost difference.
Sure you don't need to use the SDK to host a backend, it could just be a simple singular server that just runs, but I think to handle large scale loads you need to balance the load, and if you are hosting a website, you are probably going to use cloudflare for the optional DDOS protection, but if you are hosting a backend that does more than just fetch files, you kind of need to do it yourself, and you need to scale it yourself (unless you can just copy all the code if it's a common solution).
Would love to be proven wrong however, I don't do backend stuff, but I have been scoping it out.
Probably a webdev general question, but I really need to start reading some simple but practical backend code, does anyone know a good open source example that runs on either AWS/Azure/Oracle any language, and it just gets SQL or NoSQL data from a database from a HTTP or TCP request, and it's able to load balance and scale the number of servers up dynamically or manually?
>>
>>102462167
*I have already been considering just using SQLite in RAM and just make a backup that batches all the changes onto a slow network disk, because the data I work with is does not need to be reliable (I am not working with transactions or anything, just simple account login and game data), and the speed of ram should be fast enough to handle like a million transactions, I think.
I can't tell without benchmarking, but I got the feeling that to get a network drive with PostgreSQL or something that is as fast as sqlite stored in RAM is going to be very expensive (but a necessary change if I start load balancing, but I also don't know if I am overlooking a bottleneck, such as network throughput, or the ram being way slower than I expected, or there is a AWS/Azure/Cloudflare/Oracle solution or some software that sets everything up for you and works 10x better than anything I can set up)
>>
>>102458686
Swing on the JDK, sar.
>>
>>102461330
Not quite, there's also compiler dev, OS dev, and development of other tools that are old enough/have large enough non-web code bases that some dumb zoomer can't just drop in and say "let's rewrite it in javascript!" (for example, I'd imagine photoshop, cubase, premiere, maya etc. are like that. although idk wouldn't surprise me if some programs like that now have web based UIs "calling through" to a local "backend") But yeah, it's looking pretty bleak.
>>
>>102462511
Unironically the best cross platform GUI if you want something that works. It is part of Java "batteries" itself so Oracle maintains it for all platforms.
>>
>>102462883
>compiler dev
A billion toy langs and they all target LLVM.
>OS dev
A billion unbootstrappable toy OSes where installing any application from Linux/Windows from source require building the whole compiler toolchain and its dependencies which require building the bootstrappers for them ad infinitum.

Everything now is big and bloated or small and irrelevant because it doesn't support muh usecase. Everything used to be small, and you could actually compete. It's over.
>>
File: img_5e72a64e32003.png (85 KB, 1054x657)
85 KB
85 KB PNG
>>102448954
This is actually quite useful and intuitive
>>
>>102462084
there's several FUSE provider drivers out there, winfsp and dokany come to mind
wsl can just use FUSE straight up

and i might be thinking of the wrong API but i think projectedfs is meant to be more like a networked block device
>>
So I read that I should not be using "static classes" in C++ but use namespaces instead. But I can't find anything about handling the internal state of the functions of the namespace. For example let's say I have a logger namespace with some logging functions, debug, info, warning, and error, and they share a state for the current logging level. In a class I would just make it a private member, and to achieve something similar with namespaces I need to put it in an anonymous namespace. I'm not sure if this is the correct way to go about it.
>>
Developing with MinGW on Linux is one of the most painful experiences ever.

>Many open source libraries (including some from M$) still include Windows.h instead of windows.h
>if you wanna use win32 threads, some libraries will only enable them if you're on MSVC
>other libraries assume pthreads means other POSIX/Unix functionality is available
>build systems assume target OS == windows means that compile flags should be passed with forward slash
>and when you finally manage to compile your code, you need to link libstdc++ statically or ship it yourself or run it inside of MSYS2/cygwin

Should've just used .NET instead.
>>
>>102458686
.NET has Avalonia and Uno. MAUI as well, but that doesn't work on Linux.

I've only used Avalonia personally, and it's not that bad. Uno is mostly a wrapper around WinUI which also supports GTK and Cocoa IIRC.

I don't quite understand how it all goes together, but if you're using ReactiveUI and MVVM, much of your code should be reusable even if Microsoft decides to deprecate WinUI and release a new framework tomorrow.
>>
>>102453113
>>102454284
different anon here but I can relate. My current job is just making crud applications in JS and PHP which is fine and all but I remember years back when I was an intern I was doing far more. I go to look for new jobs and despite having several jobs and X years under my belt I dont feel like im any better of a candidate than when I first started. granted job listings for tech are ridiculous but still
>>
File: 1694797141357746.jpg (8 KB, 225x225)
8 KB
8 KB JPG
>>102463450
I tried to use it but found it to be cumbersome garbage
Eclipse IDE has a great built-in git client, though. Good enough that I would install Eclipse in places just to use it for Git. Shit just works with any flavor of Git
>>
What do you guys think of my Hashmap insert function?
I'm pretty sure I could get rid of the nested if statement for the key comparison after the hash comparison and just have it as just one if statement since the compiler will just do the same thing anyways.
void HashMapInsert(HashMap *map, const char *key, const char *value)
{
if ((double)map->size / map->capacity > LOAD_FACTOR)
{
HashMapResize(map);
}

size_t hash = Hash(key);
char *temp_value = strdup(value);

size_t index = hash & (map->capacity - 1);

while (map->entries[index] != NULL)
{

// Compare precomputed hash
if (map->entries[index]->hash == hash)
{
// If hashes match, compare keys
if (strcmp(map->entries[index]->key, key) == 0)
{
// Dupe found, update value and finish
free(map->entries[index]->value);
map->entries[index]->value = temp_value;
return;
}
}

// Handle collision using Open Addressing (Linear Probing)
index = (index + 1) & (map->capacity - 1);
}

Key *new_entry = malloc(sizeof(Key));
new_entry->key = strdup(key);
new_entry->value = temp_value;
new_entry->hash = hash;

map->entries[index] = new_entry;
map->size++;
}
>>
>>102463722
first off you need to get rid of the idea that encapsulation is good
encapsulation is stupid unless you're specifically protecting a resource from invalid state and everything should be public by default
the current logging level is never going to be anything other than an enum (maybe an atomic, if you anticipate multiple threads concurrently changing the logging level although i don't) and as long as it's properly initialized before it's accessed for the first time you don't need to encapsulate shit

also it's not like C# where something being accessible and actually exposed to the API basically wind up being the same thing
if another translation unit doesn't ask you for a symbol in a header it's just not going to be included

namespaces are to prevent name collisions, an anonymous namespace is effectively random
the only legitimate usecase i've seen for them is preventing external linkage to internal custom std::error_category globals, i.e. protecting global variables subject to the static initialization order fiasco problem, (the initialization order of global variables isn't defined, so invalid state), which isn't a problem anymore because of constinit

if you had some complex global value you couldn't mark constinit that other globals also use and you delegated access to it via functions that would be a solution
but generally speaking "approved" solutions would be a global variable marked constinit, a function local static variable (which is the only "approved" way to do something like a singleton) accessed by returning a reference, a universal flag, a member of a context object

>>102463728
it's also completely unnecessary
you can just point a linux native clang-cl binary at a visual studio and windows sdk dir
because clang-cl is the MSVC frontend it automatically sets the triplet correctly and a fair chunk of both style flags work
i don't know how well cmake plays with it but it's certainly very usable for simple test programs
>>
>>102464043
*plays with it when using it from linux like that
if you're just using it on windows most libraries don't seem to have that many particularly egregious issues
sometimes you have to add a check for the currently simulated compiler and that's it, which is certainly better than mingw's ideocyncracies
>>
>>102463728
I think msys2 is shit (no address sanitizer and jank with debuggers, half the debugger jank is from msvc, but msvc solves it by making the behavior of exceptions/abort different when you use the debug runtime /MDd, mingw uses msvc's release runtime /MD), but I wonder if vcpkg will package the mingw libraries for you (but msys support for vcpkg is experimental.
But obviously you are using mingw probably because of codeblocks or makefiles, you need cmake or visual studio project for vcpkg to gain access to the ability to copy DLL's to the correct location, and if you were using cmake you might as well just use msvc (address sanitizer), which should work in linux if you use wine with ms build tools.
>>102464043
>you can just point a linux native clang-cl binary
I like the idea of clang-cl, mainly because I like undefined behavior sanitizer, but it doesn't like address sanitizer, and if you debug clang-cl in a IDE / debugger, you won't stop at the location of the asan error, it will just close. Also clang-cl hates vcpkg because unlike msvc, clang-cl + address sanitzer + the debug runtime = error. You need the release runtime for address santizer on clang-cl, but here comes the flaw of vcpkg which is that it's almost impossible to get vcpkg to build libraries without the debug runtime or link to the release libraries with a debug binary (conan has a hack to link to release binaries, but there are other aspects of conan I don't like, and clang-cl isn't worth using for anything other than for CI tests or distributing optimized binaries, and you can't use clang-cl without installing visual studio with msvc, it's just an extra 2-3 gigabytes).
Also at this very moment clang-cl with address sanitizer will crash at startup unless you use WinMain and don't launch with vscarsall or something. You need to build clang-cl yourself with a newer version to avoid it.
https://github.com/llvm/llvm-project/issues/82450
>>
>>102464043
>>102464081
That's an interesting idea, thanks, I didn't think of that. However:

>To enable clang-cl to find system headers, libraries, and the linker when run from the command-line, it should be executed inside a Visual Studio Native Tools Command Prompt or a regular Command Prompt where the environment has been set up using e.g. vcvarsall.bat.

I would hope that everything vcvarsall.bat is set some env variables, but since it's Microsoft, who knows...
The linker could be a bigger problem. Rust has a similar issue, you can't build for Rust MSVC targets on Linux because it relies on the MSVC linker. I'm not sure what the MSVC linker does in particular that you can't achieve with lld.

>>102464194
I'm using MinGW on Linux, not MSYS2. I'm actually using Conan and CMake. Ideally I would like to be able to generate both MSVC + MSBuild projects and MinGW + Ninja/Make with my setup.

I gave up on vcpkg early on, it's way too tedious. You have to set the target OS variables for vcpkg and CMake itself separately and use two separate toolchain files. With Conan, it will build all your dependencies with your Conan profile and then generate a CMake toolchain file based on the profile.

Do you have clang-cl working on Linux?
>>
>>102464330
>To enable clang-cl to find system headers, libraries, and the linker when run from the command-line, it should be executed inside a Visual Studio Native Tools Command Prompt or a regular Command Prompt where the environment has been set up using e.g. vcvarsall.bat.
>I would hope that everything vcvarsall.bat is set some env variables, but since it's Microsoft, who knows...
that hasn't been necessary for a very long time, clang-cl has explicit flags for the paths it needs
/diasdkdir <dir>        Path to the DIA SDK
/vctoolsdir <dir> Path to the VCToolChain
/vctoolsversion <value> For use with /winsysroot, defaults to newest found
/winsdkdir <dir> Path to the Windows SDK
/winsdkversion <value> Full version of the Windows SDK, defaults to newest found
/winsysroot <dir> Same as "/diasdkdir <dir>/DIA SDK" /vctoolsdir <dir>/VC/Tools/MSVC/<vctoolsversion> "/winsdkdir <dir>/Windows Kits/10"


as long as the paths are set up similar to a visual studio install you're good
>>
>>102461424
I consider backend to be web dev also, as long as it's related in some way to a web page. I'm writing self-hosted server applications like Jellyfin etc, the backend is "web development" as far as I'm concerned, because it all relates to, ultimately, displaying data over HTTP.
>>
>>102464330
Ah, now that I think about it, the MSVC linker is probably for generating PDBs so you can have debug symbols in WinDbg or Visual Studio. Still, don't think you can get the MSVC linker on Linux
>>
>>102464518
True web devs are allergic to databases, logic, and managing sessions.
They call fetch and show the resource, everything else is for nerds.
>>
>>102464589
lld-link
i don't actually know if it can handle pdbs on linux though, it might require the DIA SDK
>>
>>102464330
>Do you have clang-cl working on Linux?
I would not be surprised if you can install msbuild tools in wine (which installs the bare minimum msvc tools), then compile clang-cl from LLVM source, and then just use clang-cl (maybe you could even install visual studio 2019/2022 on wine and install clang-cl through the installer? but I am 90% sure it won't work, and it probably has to do with web content, wine can't run web browsers).
wine has always surprised me with stuff just magically working, you can build a msvc project, and then run valgrind on it through wine, which could be wsl, and get memory diagnostics from that, also debuggers also work, but I have never tested address sanitizer on wine, but I don't see why it wouldn't work?
if there was one criticism for windows asan, it's that it creates millions of invalid memory access errors, because it checks for invalid memory by making every access into a exception and then checking the memory in the handler, you need your debugger to ignore the exception, but asan should guarantee that you won't get an invalid memory error, all segfaults/crashes should be asan reports, but this means you need to remember to fix your debugger so it catches invalid memory errors when you stop using asan, or save the configuration to the project somehow, also 32bit asan doesn't make the exception for some reason.
>vcpkg
I don't like conan because it produces the cmakepresets.json, which is fine since it does work for you (I assume it sets the toolchain path for each preset?), but I personally think cross compiling is flawed because you probably want to test your code anyways, like even if you don't have an automation test, you are probably making an GUI application, you should be manually testing it before releasing it (it's impossible to write a good test for a GUI), especially if the majority of people are downloading the windows version.
>>
File: kode_mono.png (428 KB, 1920x2160)
428 KB
428 KB PNG
I mostly like this font, but the a and the dot on the i look weird
>>
>>102465066
What''s wrong with the a?
>>
Why shouldn't I just design every API that doesn't need to be accessible through the web and doesn't need to use UDP (TCP or QUIC is fine) using gRPC + protobuf v3?
>>
How many LoCs justify splitting up a project?
>>
>>102464816
>crosscompiling is flawed
You bring up an interesting point.

When it comes to MinGW, you can test your application in Wine. In fact, that's probably a great idea when making any Windows application. If your app runs in Wine, then it will probably also still run on Windows 7.

If you're targeting a different CPU architecture, but sticking to Linux, you can test it with user-space QEMU. GUI applications might be a problem, but it should work for CLI apps.

Or you could just run it in a VM, and then debug via GDB remotely
>>
Please explain how exceptions are meant to be used. I'm having trouble understanding when someone on the internet says that the exception try...catch(except)...(else)...finally blocks should be as narrow as possible, but then put a whole function call in there.
Let's say i want to read a string value from a (string -> string) map, and then convert it to an integer. The function that takes the value of the key in the map can throw an exception typed [key error], and the function that parses an integer from a string can throw an exception typed [value error]. Of course, who knows what else those two functions may throw in their implementation, because these are not Java-esque checked exceptions. With that information, how am i supposed to write this piece of code? Do i include both function calls in a single try...catch block and catch both exception types? What if the function that reads the map also throws a [value error] type exception? Please help.

(assuming languages with heavy runtimes that seem to encourage the use of exceptions instead of tuple return values or discriminated unions or sum types or whatever it's called in the language)
>>
>>102467494
Here are a few valid reasons to split up a project:
- code reuse between two or more projects (pull out the common code into a separate source file(s));
- filesystem file size limits;
- text editor file size limits.
>>
>>102467627
In these programming languages any line of code (or any expression) can raise an exception of any type. If that is true, isn't it impossible to reliably distinguish between different types of exceptions, meaning that differentiation of specific subtypes of exceptions should never be used for the program logic? Isn't the only thing that can be done at that point is to attempt to clean up, and terminate the program?
The worst thing i've seen is the Python's AssertionError. If your code catches this error, what can you do? Is some of the program's state in some library now corrupted, or was it just a precondition/postcondition assert in a pure function? You may never know. If the process is not terminated at that point, who knows what's going to happen.
This is driving me nuts.
>>
>>102467627
How to handle exceptions depends on what the code throwing exception is doing and where it is used.

>Let's say i want to read a string value from a (string -> string) map, and then convert it to an integer. The function that takes the value of the key in the map can throw an exception typed [key error], and the function that parses an integer from a string can throw an exception typed [value error].
This is the core of your issue. You should think at a higher level of abstraction. Not "this variable/this method", but "this behavior".

What is the actual reading and parsing for, is it reading some configuration? Parsing data values? Reading a status code?
Where/by what is this read-and-parse code used?

All that affects whether an exception would be better caught or thrown, and each type of exception handled collectively or separately.
>>
>>102467743
>In these programming languages any line of code (or any expression) can raise an exception of any type.
That's a weak understanding, it's like you completely ignore the whole business logic of the code.
Yes, theoretically any piece of Java code could throw something like a NullPointerException. In practice, you generally write code that either initializes everything so there's no null values, or checks and handles values that might be null - and if they are null, you might then throw an exception but also describe the conditions for that exception in a javadoc.
>>
>>102467857
Pardon me for the incomplete rambled example, let me restate it properly:
I have:
- the Map (string -> string);
- the Key (string) (let's say its a static const string).
I want to read a value in the Map with the Key, parse the value as an integer. If the Key is missing in the Map, then the fallback integer shall be '-1'. If the string is not a valid integer, then the fallback integer shall also be '-1'. If anything else happens (e.g. a Key Error thrown by the parsing function, or a Value Error thrown by the Map Get function), then it's probably a bug and the program should just terminate.
>>
>>102467957
What i'm trying to say is that i think there is no way to know if catching an exception of a certain type and carrying on is safe or not, unless it's your own exception type that you know exactly where and under which condition it is thrown.
I can't formulate it clearly, but i'm pretty sure this problem is related to dynamic typing or static code analysis.
I have modules A, B, and C, where A calls into B and B calls into C. If module C throws an exception that B just passes through, and A catches it, then the code is potentially broken, and the compiler will not tell you anything about it. It's going to a runtime bug, and i pray to gods that it will just crash and not overwrite the hard drive with my family photos.
>>
File: durga checkem.jpg (31 KB, 581x538)
31 KB
31 KB JPG
>>102468013
You still didn't explain what the map actually is or where/how is it used.

>>102468111
>What i'm trying to say is that i think there is no way to know if catching an exception of a certain type and carrying on is safe or not
Most libraries are well-described in this regard. Read the documentation.
Or if you're handling some really shit code with no description or logic how it throws exceptions and/or how it behaves after throwing them, it's just something you have to deal with. Usually the safer route is to abort the whole process using that object, but that's not a hard rule.

Also, you should really stop completely ripping all abstraction off your problems because then you're left with just meaningless code. "module A", "module B" and "module C" have no meaning. It makes it all the harder to both explain and understand how things work.

Generally:
Is it suitable to handle the exception at this level of abstraction? Catch.
Is this module not a good place to handle the exception, or it is unable to continue itself because of the exception? Throw.
Don't know/not sure? Throw.
>>
>>102461372
GBA game devs did that too and that's the reason I've adopted that practice as well
>>
It sounds like you're describing a scenario where you want to safely retrieve a string from a map and parse it as an integer, while handling two specific types of exceptions: `[key error]` for missing keys and `[value error]` for invalid integer parsing. Since you're working in a language where exceptions are not checked (like Python, JavaScript, or similar), you want to gracefully handle these specific errors, but also have a fallback for any unexpected exceptions.

1. **Handle Key Errors**: Safely retrieve the value from the map. If the key doesn’t exist, catch the specific `[key error]`.
2. **Handle Value Errors**: Attempt to parse the string into an integer. If parsing fails, catch the specific `[value error]`.
3. **Catch Unexpected Errors**: Catch any other unforeseen exceptions.

Below is an example in Python-like pseudocode, assuming you're using a language with exception handling capabilities:

```python
def safe_get_and_parse(map_obj, key):
try:
# Attempt to get the string value from the map
value = map_obj[key] # This could throw a 'key error'

# Attempt to parse the string value to an integer
return int(value) # This could throw a 'value error'

except KeyError: # Handling missing key in the map
print(f"KeyError: The key '{key}' does not exist in the map.")

except ValueError: # Handling invalid integer conversion
print(f"ValueError: The value '{value}' cannot be converted to an integer.")

except Exception as e: # Catching any other unforeseen exceptions
print(f"An unexpected error occurred: {str(e)}")

return None # Return a default value (None or another appropriate default)
```

### Notes:
- **KeyError** is the exception for missing keys in the map.
- **ValueError** handles failed integer parsing (e.g., when the value is not a valid integer).
- **Exception** catches any other unexpected exceptions to ensure robustness.
>>
btw. This answer came from ChatGPT, I just fed it your question.
>>
>>102469821
Meant for
>>102468013
>>
>>102454340
Go. It’s essentially c with all the sharp/rough edges sanded down to be easy to use. It’s very enjoyable if you care about building stuff instead of geeking out over obscure language features (rust)
>>
>>102469530
Thanks, your answer gave me some understanding i didn't have, but then this post came:
>>102469821
>value = map_obj[key] # This could throw a 'key error'
This part is interesting. It says that the operation could raise KeyError, and that is most likely 100% true for the builtin dictionary. But what happens when you pass some other implementation of a mapping type to this function? This implementation could raise ValueError (or its subtype) directly or indirectly due to a bug somewhere deep, and now you are hiding this bug by catching (KeyError, ValueError) in the same try...catch block. This is unacceptable, isn't it? I understand if the dictionary lookup example is too simplistic, but this same problems applies to higher levels of abstraction, is it not?
>>
>>102470084
Any mapping type should implement the __getitem__() method which is what the self[key] syntax sugar is calling implicitly
https://docs.python.org/3/reference/datamodel.html#object.__getitem__
https://docs.python.org/3/library/stdtypes.html#typesmapping
I have no idea why a string to integer conversion function would be handling language exceptions, in any case. Those ARE errors and they should raise blocking exceptions, that's the entire purpose of them.
>>
>tfw you get your program from 250ms to 60ms while only costing a extra 4mb of ram
Thank you hashmaps and file indexing
>>
>>102470084
You're absolutely right—this issue extends beyond the simplistic example of a dictionary lookup. When you're dealing with abstract data types (ADTs) or interfaces (like Map or Dictionary), you cannot always predict the specific exceptions that a particular implementation might throw. Simply catching a broad exception like KeyError (or ValueError) could indeed hide underlying bugs or unexpected behavior in certain implementations, leading to unintended consequences.

This problem is particularly relevant when:

Working with different implementations of an interface: One implementation might behave exactly as expected, while another might throw different exceptions for the same operation.
Dealing with bugs in third-party libraries: A function might unintentionally throw exceptions that aren't documented or expected.
>>
File: lineshj234.jpg (45 KB, 740x387)
45 KB
45 KB JPG
how many lines is your current project?
>>
>>102470441
>only 4mb
>>
>>102453113
Best way to avoid this is to artificially make your work projects way way more challenging than they need to be. Don't use any libraries, write everything yourself.
>>
>>102470782
4mb memory is a decent tradeoff for a 4x speed up imo.
>>
>>102470668
5600 lines
>>102470782
The program only uses 6mb ram in total, Im going to add a option so you use the older method anways. You should also keep in mind that im searching icons in /usr/share/icons, those icon themes have a lot of files.
>>102470818
Exactly
char *LookupIcon(IconTheme *theme, const char *icon_name, int size, int scale)
{
if (access(icon_name, F_OK) == 0)
return strdup(icon_name);

char closest_icon_path[512];
int min_size = INT_MAX;

for (size_t i = 0; i < theme->icon_dirs->size; i++)
{
XDGIconDir *curr_icon_dir = theme->icon_dirs->data[i];

// First check the hash map for the icon
const char *icon_path = HashMapGet(curr_icon_dir->icons, icon_name);
if (icon_path != NULL)
{
if (DirectoryMatchesSize(curr_icon_dir, size, scale))
{
return strdup(icon_path); // Exact match
}

// Calculate the size difference to find the closest match
int size_delta = DirectorySizeDistance(curr_icon_dir, size, scale);
if (size_delta < min_size)
{
min_size = size_delta;
strlcpy(closest_icon_path, icon_path, sizeof(closest_icon_path));
}
}
}

// Return the closest icon path found
if (min_size != INT_MAX)
return strdup(closest_icon_path);
return NULL;
}
>>
>>102448954
Does anyone know how to convert data between linear format and tiling (optimal) format in opengl? The tiling data is how textures are stored in opengl but linear format is how video frames are stored in nvenc/vulkan video. The tiling format seems to depend on the gpu and drivers, etc, so it's implementation defined so I cant just create a shader to convert the data (right?).
>>
I've been scraping a news website for about 1.5yrs now, storing any new articles in their entirety as well as meta data like tags, author, date of publication. There's i think 20 - 30 thousand rows last I checked. Could I get in legal trouble for sharing it/uploaing it online? I don't really have any use for it personally. Originally i had plans but i ended up never getting around to any of them. Would anyone even want such a thing?
>>
>>102470649
This ChatGPT thing sucks balls, huh. What a way to say absolutely nothing!
>>
>>102471179
Encrypt, upload, and use the first word in the name/description of whatever public you post it as the encryption key. You achieve bulletproof plausible deniability, as long as they don't find the original unencrypted files on any devices in your possession.
>>
>>102470668
zero, I haven't coded anything serious in forever, just a little of scribbles pencil on paper diagrams
>>
>>102470668
almost 10k
>>
File: faggot.png (44 KB, 760x360)
44 KB
44 KB PNG
>hurr durr caze ezpleshion nod consdand
Like I care?
>>
>>102474469
Oh, and yet again huge thanks for Microsoft for removing inline assembly capabilities. If there ever was the need for an inlined and aligned 32-byte copy with two vector instructions it's right here, and I can't fucking use it because Pajeets took over.
>use clang-cl
Last I checked you needed cmake for that, and I would rather much die than use that piece of rancid crapware ever again.
>>
File: nextwatch_4c.webm (1.13 MB, 1920x1200)
1.13 MB
1.13 MB WEBM
Made this in an hour to pick the next slop
When I pick one it gets added to a json file
If watched, names are prepended with [W]
It can filter out watched items
>>
Would making something that can emulate win32 applications on non-x86 linux environments be worth it?
I've noticed that box64 and wine tend to not be very optimal/efficient when emulating certain windows apps on arm linux.
>>
>>102471179
>Could I get in legal trouble for sharing it/uploaing it online?
yes, since it's copyrighted content. But they may not care enough to go after you, much less peruse filesharing sites on the odd chance that someone is uploading their oc.

>Would anyone even want such a thing?
depends on the type of news website. If it has a lot of political news I would be interested in it, if it doesn't take too much hdd space. I'm a bit of a hobby historian and I have all sorts of historical books, news articles, photos, communcations and scriptures.
>>
>>102474578
>inb4 just use intrinsics bro
Been there. Done that using _mm256_load_si256 and _mm256_store_si256. Code generates vmovdqu instructions instead of vmovdqa instructions, why the *fuck* would you assume I wouldn't use the aligned version unless I knew what I was doing?

_mm256_stream_load_si256/_mm256_stream_si256 at least keeps the alignment hint, but ever since I learned that non-temporal instructions are always non-temporal even if the data exists in some cache (unless it's the uber-special NT prefetched cache, which is, for inexplicable reasons, separate from the normal cache) I avoid them like the plaque. When prefetchers were still garbage they may have had a reason to exist, but nowadays they're useless.

Oh, and let's not forget the retarded vzeroupper, shall we?
Intrinsics - never trust the fucking compiler. Never!
>>
>>102474586
impressive
>>
>>102474469
function pointers aren't constant??? what the shit
>>
>>102475087
how is that surprising
>>
>>102475087
Thanks to relocatable binaries, yes.
I assumed the linker was smart enough to add fix-ups for the values, but apparently I was too optimistic.
>>
>>102475124
static void f() {
char array[(int)&g];
}
static void g();
>>
>>102475142
well not this but you get the point
>>
>>102475142
That's a reference to a module-internal function. They exist within the same code segment and the distance between them is always going to be the same (a lot of instructions use offsets relative to the current RIP). NtAllocateVirtualMemoryEx and cohorts do not exist in the same code segment as my code; they exist over in ntdll.dll, which can be loaded wherever.
>>
>>102448954
Just going thru automate the boring stuff with python, got to sequences
>>
>>102449587
crack your skull on the sidewalk while you're at it :)
>>
>>102474895
>even if explicitly told to assume 32-byte-alignment the compiler will NOT generate vmovdqa instructions
Compiler builders are such a joke, holy shit.
>>
File: YIla1Pym_400x400.jpg (23 KB, 400x400)
23 KB
23 KB JPG
maybe the first non trans actually female programmer i've seen on github that actually writes code and not just hello world/python script/blogging

https://github.com/lexi-lambda
>>
>>102476017
Bad news
https://www.youtube.com/watch?v=5QQdI3P7MdY
>>
Ok C23 is kinda kino
>>
File: 1601091622592.jpg (23 KB, 258x245)
23 KB
23 KB JPG
>>102476017
>>102476072
>>
File: .png (9 KB, 935x166)
9 KB
9 KB PNG
picrel is the process monitor for a game I ran without having the proper locale
why is it working when it runs to open as a directory but not when it opens as a file?
>>
>>102476304
Elaborate.
>>
>>102476072
>>102476337
look up "gabriel gonzalez haskelll"
>>
>>102474586
Looks like rofi.
>>
>>102470649
>A function might unintentionally throw exceptions that aren't documented or expected.
That's why you don't normally catch what you don't expect, at least on some level, and you definitely never do that and just swallow the exception. If some fuckwad is throwing something stupid, you want to find out about it!
>>
>>102476404
https://youtube.com/watch?v=lLv1s7rKeCM
>>
File: create_file.png (4 KB, 308x228)
4 KB
4 KB PNG
>>102476392
>QueryDirectory
>CreateFile
Those functions do not exist. There's NtQueryDirectoryFile (always takes UTF-16 strings), CreateFileA (always takes ANSI strings), and CreateFileW (always takes UTF-16 strings). Assuming that QueryDirectoy maps to NtQueryDirectoryFile, and considering that NtQueryDirectoryFile always takes UTF-16 strings, it's likely that the devs were forced to use proper UTF-16 strings and APIs when accessing directories. Since the ANSI equivalent to CreateFileW (CreateFileA) exists they probably didn't bother using UTF-16 strings when accessing files.

In short: the devs fucked up. Which, considering that they're Japanese, doesn't surprise me. The term for mangled characters due to using an invalid character encoding is a Japanese one after all, too: https://en.wikipedia.org/wiki/Mojibake
>>
>>102448954
Ruby on Rails in 2024, yes or no and why.
Go.
>>
>>102476533
>Those functions do not exist.
Strictly they're macros that map to the implementation (...A or ...W) depending on some #define that I always forget.
My code just uses the ...W variants, as it already knows how to make sure the strings are in a useful encoding.
>>
>>102476783
>depending on some #define that I always forget.
UNICODE and _UNICODE.
>>
File: .png (64 KB, 763x549)
64 KB
64 KB PNG
>>102476533
many thanks for answering
I checked procmon a little more and found it has a stack trace(?)
I have no idea how to read this but I did find that it seems to use both W and A version of the functions
>>
>>102476834
Let's start with the right side. The reason why CreateFileA calls CreateFileW, which calls NtCreateFile, is because most NT kernel functions only ever deal with UTF-16 strings (UTF-8 didn't exist at the time when NT came out, and Microsoft is a backwards compatibility whore, so they're just stuck with it). CreateFileW also only ever deals with UTF-16 strings, so there's no need to convert the string between CreateFileW and NtCreateFile.
Now, when CreateFileA is called with an ANSI string, it doesn't call an NT kernel equivalent because no such equivalent exists - remember, the kernel mostly deals with UTF-16. So it instead converts the given ANSI string into UTF-16 into its own temporary buffer and then passes it together with all the other arguments to CreateFileW. Since the chain begins with CreateFIleA we know that the devs call this function explicitly.

On the left side, however, the chain does not begin with FindFirstFileA, but with FindFirstFileW, which confirms my initial assessment. The devs were switching between UTF-16 and ANSI, probably due to earth-shattering incompetence.
>>
>>102476957
oh, so it's bottom up, makes sense
but from what I'm understanding, most japanese games require the jap locale simply because they didn't bother using the W versions of the functions?
like, the entire reason why LocaleEmulator is a thing is just because they write a fucking A instead of a W?
>>
>>102476957
You might also wonder
>why all this CreateFile and NtCreateFile nonsense?
That's because CreateFile still hails from the days when Windows had a strong MS-DOS underbelly. It used to be part of the kernel - literally, as part of kernel32.dll - but NT and NtCreateFile have since supplanted all this nonsense. Most programs still only ever call CreateFileW because NtCreateFile is ... ... special; it's not only used for file accesses, but also the NT namespace, and requires an appropriate prefix (\??\) before the actual path so that it knows it's supposed to access the file system.
>>
File: 1716592983657580.png (160 KB, 368x368)
160 KB
160 KB PNG
>>102448954
Is reading lots of code on github an efficient way to learn?
I've only ever done very small solo projects, but want to improve my skills
>>
>>102477105
>\??\C:\
what backwards compatibility does to a mf
>>
>>102477050
>so it's bottom up
Yes.
>like, the entire reason why LocaleEmulator is a thing is just because they write a fucking A instead of a W?
Probably not entirely. Locales don't just hold information about which character encoding to use implicitly, there's also character sorting (is "ä" following an "a" or a "z"?), currency information, decimal BS ...
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=msvc-170#generic-text-routine-mappings

Also, as >>102476783 noted, there's a chance they simply used generic CreateFile, which would've mapped to CreateFileA if UNICODE/_UNICODE wasn't specified. Accidental omittance is more likely.
>>
>>102476411
There are at least two more but less proflic.
>>
When I look at a tweet with 1000+ replies, I can't seem to load all of them. I'm logged in on my account (it's a few years old but I don't have premium), using the normal twitter website, but I can only load perhaps 100 or 200 replies.
How do I get to see all of them?
>>
>>102477734
Programming?
>>
>>102477813
Yeah I want to, but I can't even get the data.
There's a developer API but it sucks ass. I was thinking I could do good old Web scraping but if the data won't even show in my browser how would I scrape it
>>
>>102448954
I am reading the basic documentation for Kotlin on W3 and it seems a lot like Javascript at least in syntax (which is not a bad thing for me). What exactly sets it apart? In what cases is it usually used? I see it mentioned a lot so I am making an effort to learn more about it.
>>
File: h.png (7 KB, 1200x848)
7 KB
7 KB PNG
!!!
>>
For those who don't do webdev:
What do you even do? How is programming on a field that is not webdev like? How did you escape webdev? What language do you use? What projects can I do?
>>
>>102478626
Kotlin is Java with no nulls, Java interop, and supported by Google for android development (if you don't want Flutter).
https://kotlinlang.org/docs/comparison-to-java.html
So basically if you want to do Java and find out you like to write Kotlin more.
>>
>>102479207
>How did you escape webdev
Step 1: Never do webdev in the first place
>>
>>102479238
That's what I'm trying to do but I can't seem to find a job. Everything in linkedin/indeed/glassdoor seems to be webdev. Besides, I have no idea what language to pick and what projects to do.
>>
>>102476533
>>102476957

if you ever wake up from your binary retardation, you will stop calling "A" functions ANSI, they are whatever you choose, and whatever better be UTF8 so you dont screw up next time

as usual education came from high level language specialist. keep on babbling.
>>
>>102480030
>you will stop calling "A" functions ANSI
A stands for ANSI
>>
>the retard PHP dude is retarded
In other news water is wet, more at eleven.

>>102479207
>What do you even do?
I use butterfly flaps to manipulate atmospheric eddy currents to toggle individual bits on my platters.
I also use HDDs, which still have platters.

Oh, and there's C and assembly, I guess.

>how is programming on a field that is not webdev like?
Simpler. Not easier, but simpler.

>What projects can I do?
Registry dumper.
>>
>>102480378

that binary retard is from so-called "socialist camp", being there still a retard.. there is a saying - its a "dick" written on the fence but its a pilewood laying there
>>
I've seen AI shit out smarter posts than you.
Can you try again?
>>
File: fuck.png (53 KB, 257x257)
53 KB
53 KB PNG
How do you guys even choose a language and a job? I've done some shitass projects with some langs and databases, but didn't go balls deep in any. I know a fuckton of things and am a master of none.
80% done with CS and my colleagues say i'll def be the highest earning amongst them but it's all academic or basic knowledge, actually i'd even say i just "know the basic logic structure" and adapt bc everything is just assembly with extra steps and stupid design rules.

Do i just rawdog AWS/Azure/Wordpress with alcohol and go webdev like everyone?
>>
>>102481302
>How do you guys even choose a language
You learn assembly, then you compare the quality of the code that languages churn out. By the end of it C is the sole winner because it doesn't shove copies and allocations and exceptions up your arse.

If you can't do that, then you'll forever be stuck in mediocrity.
>>
>>102449083
Memory ownership can be difficult to trace, and requires more careful design to be easy to assess. GC automates this which is convenient for developing quickly since you don't need to think about memory stuff as much. It is a dev time tradeoff -- a "worse is better" situation.
>>
>>102453731
All Go executables are standalone and interface with the host directly. Unless you're using some facility to explicitly dynamically load a library then everything is included in the ELF. Your swift binary is dynamically linking in libc and who knows what else. Please use ldd to determine the actual cost before making assertions about binary size as just looking at the size of the ELF on disk is disingenuous.
>>
>>102481412
>Memory ownership can be difficult to trace
If you do it on an object-per-object basis, sure. Which is why smart people use arenas.
>>
>>102481377
While i absolutely agree with everything said and think a well written monolith is better than a hundred trannyservices, the next step is 'getting a job in C' which is impossible depending on where you live.

Based on that, should i shove Go up my ass?
>>
>>102481547
>'getting a job in C' which is impossible depending on where you live.
Then make something that the competition is too incompetent and sluggish to counter, and be 10% cheaper than they are.
>>
>>102481547
just get a job doing C++. If you work for a boomer corp they'll be writing C style C++ anyways so you can blow your leg off with C footguns while you waddle to the next function with all your bloat
>>
>>102481639
>footguns
begone shill, rust lost the electron
>>
>>102481302
Look job postings in your area and pick Java/C#/Go or whatever they want to maintain whatever boomer corp framework they have.
>>
C/GTK or Python/pyobject?
>>
>>102482438
>Python/pyobject
Into the trash it goes.
>>
>>102482592
Why?
>>
>>102482598
By writing or executing Python programs, you deny good life to yourself, everyone around you, and all of the future humanity. Just like Christianity, Islam, and Judaism deny the idea of good life, replacing it with a promise of the "real life" after death.
>>
for list syntax do you prefer

List<Type>

or

[Type]
>>
>>102482971
I prefer collections.abc.List[Type] myself.
>>
>>102482971
[Type] over List<Type>
(A, B, C) over Tuple<A, B, C>
[(Key, Value)] over Map<Key, Value>
>>
Is os.system(powershell.exe -file myscript.ps1) the easiest way to ssh into a remote host with a username & password from python?

I need to automate running a bunch of cmd and ps commands on lots of computers and want to send the output either to a file or to my python tkinter gui
>>
>>102482971
*list
list_length
>>
>>102482598
Outside of data science, it's a toy language.
>>
>>102482971
void*
>>
File: 1618730424565.jpg (62 KB, 976x850)
62 KB
62 KB JPG
just realized adding and resizing vector could invalidate spans pointing to it
>>
>>102481302
>but didn't go balls deep in any. I know a fuckton of things and am a master of none.
bad decision
you're better off specializing in one

>Do i just rawdog AWS/Azure/Wordpress with alcohol and go webdev like everyone?
do you want to be a codemonkey of the lowest tier?
>>
>>102483691
export template<typename T = byte, size_t sz = std::dynamic_extent>
class sk_span_position_t {
public:
size_t byte_pos{}, elem_count{};

constexpr size_t size() {
if constexpr (sz != std::dynamic_extent) return sz;
return elem_count;
}
constexpr bool empty() { return byte_pos & size(); }
template<typename PtrT = T, size_t argsz>
constexpr PtrT* get_ptr(std::span<byte, argsz> base) {
return reinterpret_cast<PtrT*>(base.data() + byte_pos);
}
template<size_t argsz>
constexpr std::span<T> get(std::span<byte, argsz> base) {
return { get_ptr(base), size() };
}
template<size_t argsz>
constexpr T& get_one(std::span<byte, argsz> base, size_t index = 0) {
return *(get_ptr(base) + index);
}
};
>>
>>102484004
oops
    size_t byte_pos{ -1 }, elem_count{};
constexpr bool empty() { return (size_t(-1) - byte_pos) & elem_count; }

>>
i can't figure out how to add print statements to my compiler
i'm only working with expressions and everything has to ultimately return a value
adding side effects just fucks everything up but right now you can only view the whole program output
>>
File: 1726702809990630.jpg (88 KB, 1000x590)
88 KB
88 KB JPG
>>102449083
as soon as you stop making fizzbuzz clones and start writing big complex projects is when you will realize how retarded you are. it's not just
void asd() {
Thing* thing = malloc(sizeof(Thing));
//stuff happens here
free(thing);
}

memory management gets much more complicated.
>>
>>102453731
>comparing hello world binary sizes

peak hobby programmer
>>
>>102485798
well done. these c-nile cosplayers have never worked on anything more complicated than their little programming exercises.
>>
>>102484004
God, modern C++ is so ugly.
>>
>>102485798
>he's using malloc
Opinion discarded.
>>
>>102485798
>>102485831
Skill issue
https://github.com/purpasmart96/jwms/blob/master/src/darray.c#L10
https://github.com/purpasmart96/jwms/blob/master/src/darray.c#L44
>>
>>102485982
>allocating the metadata on the heap, too
Skill issue indeed, but in your linked code.
>>
>>102485798
indeed, it's just
"put thing in an arena"
"free arena"
impossibly hard
>>
>>102485888
how do you not use malloc?
even if you use stuff like arenas you still need to allocate the arena's memory
>>
>>102486526
He's going to go on about mmap or whatever the Windows equivalent was, and pretend like it makes any difference to your question.
>>
>>102486526
mmap/VirtualAlloc. They support bigger page sizes, and VirtualAlloc specifically allows for virtual address space reservations without over-commit and fear of OoM (unlike Linux).
>>
>>102486526
The dude has no idea what hes talking about. Unless your doing embedded programming there is isn't really any issue with the heap.
>>
>>102486583
>>102486586
kek
>>
>>102486592
My god, that guy is so predictable.
>>
>>102486587
No, YOU have no idea what you're talking about. Which is why you'll always remain mediocre.
>>
>>102486611
Do you have an actual counterargument, or did you already admit defeat?
>>
>>102486624
I'm so tired of your schizo nonsense, and you aren't worth engaging with outside of calling out your bullshit.
>>
>>102486612
Post your code or gtfo
>>
>>102486637
Awwwwww, are you tired of hearing the truth? Hold on, I have a thought: maybe ... you could LEARN from people who know more than you do, and then YOU would be the one who could tell others what they should do.

How's that sound? Or do you actually LIKE being mediocre?
>>
>>102486650
You first. Some actual, nice code from an actual project you've been working on.
>>
>>102486663
/pol/tard tactics doesn't help your point like you think it does.
>>
>>102486676
I already did, why don't you?
>>
>>102486684
>not answering the question
See, I gave you a chance to speak, even asked you a simple yes or no question, and all you had to produce was verbal garbage. No wonder no one ever takes you seriously.
>>
>>102486708
Where?
>>
I wrote my password manager in python as well as a sanity check and a redundancy for when Gnome blows up gtk.
>>
>>102486711
You seem to be under a great misunderstanding that anybody takes YOU seriously.
Just get over it bro, you're never going to be Terry Davis. At annoying as schizo faggots are, at least he actually had something to show.
>>
>>102486747
>anybody takes YOU seriously.
They sure do. It's only incompetent nocodeshitters like you with no valid opinion who try their hardest at convincing me otherwise.

Newsflash: you'll always fail.
>>
>>102486769
Just keep replying, wannabe-kun. Remember in an internet argument, the last person to post wins!
>>
Exactly!
>>
>>102486730
Here
>>102485982
>>
>>102486746
Looks great anon, although I would of picked Go over Python imo
>>
File: how_to_realloc.png (20 KB, 458x680)
20 KB
20 KB PNG
>>102486814
Alright, here's how I'd do it.
>>
>>102486845
Isn't go owned by google though?
>>
>>102486872
Yes, but go is probably the closest language to C when it comes to simplicity, Id argue the rust is more corporate controlled.
>>
>>102486936
nta but Go is such a wagie language
>>
File: two_terminations.png (17 KB, 678x480)
17 KB
17 KB PNG
>NtTerminateProcess doesn't terminate the process
>only ends all threads but either the calling or the main one (not sure which, it just happens to be the same)
So the MS documentation is officially wrong now: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-zwterminateprocess
>The ZwTerminateProcess routine terminates a process and all of its threads.

Why they call it a second time? I can only guess.
>>
File: ldr_shutdown_process.png (38 KB, 780x456)
38 KB
38 KB PNG
>>102487539
>inb4 that check only exists if you terminate processes other than your own, the first call doesn't return
Bitch I get an access violation in that LdrShutdownProcess call because I don't bother flushing my output buffer once the handle's closed in the first NtTerminateProcess call. The process definitely keeps going on the main/calling thread.
>>
>>102486867
a syscall for each allocation?
>>
File: 1698236152846220.png (3 KB, 145x55)
3 KB
3 KB PNG
Is there actually use for emoji in code?

I find that a picture can tell 1000 words kind of thing.
So instead of a message saying "PASS" you can have a green tick emoji
>>
Assume I pass a pointer to a user-defined type containing many data members to a function in C. If I modify any of those members within the function, do those changes remain after returning?
>>
>>102488968
you could make the words colored
like making the PASS green
>>
>>102488983
very obviously, yes
but if you don't want that you can do something like
void func(type* original) {
type tmp = *original; // this copies
tmp.a = 0;
}



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.