← Home ← Back to /g/

Thread 107162667

85 posts 16 images /g/
Anonymous No.107162667 [Report] >>107162678 >>107162955 >>107163071 >>107163100 >>107163111 >>107163181 >>107163488 >>107164024 >>107164025
Why do C and C++ programmers love to write automatable boilerplate code by hand?
Are they all retired or what? Most people have only 2-3 hours of free time every day after their work which means they are very limited if they want to finish their projects.
Yet C and C++ programmers are acting as if they have all the time in the world. What gives?
Anonymous No.107162678 [Report] >>107162680 >>107164096
>>107162667 (OP)
you can't make gui apps with go
Anonymous No.107162680 [Report]
>>107162678
https://github.com/diamondburned/gotk4
???
Anonymous No.107162955 [Report]
>>107162667 (OP)
I had a C++ assignment where i used a json library to serialize/deserialize but it was a performance bottleneck. Writing my own de/serializer improved performance about 15x
Anonymous No.107162976 [Report] >>107163071 >>107163892
Only a retard would use low-level language, to write applications. There is python and java that are much easier to write code with and speed is not an issue due to the fact that modern computers aren't potatoes.
Anonymous No.107163071 [Report] >>107163149 >>107163438 >>107163855
>>107162667 (OP)
>rust tranny and resident child rapist can't even make up fantasy stories anymore
your topic of expertise is child rape and failing at life. unless you've got tips relate to rape and failing, you're way out of your league. what other schizo babble do have so we can shit on it?

>>107162976
>when you're so talentless and bereft of any skills that you truly believe only "retards" use a low level language and you shill java and python
it's amazing how you talentless no-coding fucking niggers don't know anything about anything.
Anonymous No.107163100 [Report]
>>107162667 (OP)
We turn to cubercrime and are rich. We have free time. We are cyber pirates and never regret it.
Anonymous No.107163111 [Report]
>>107162667 (OP)
We turn to cybercrime and are rich. We have free time. We are cyber pirates and never regret it.
Anonymous No.107163149 [Report] >>107163278
>>107163071
>do have so we
good morning sir
>child rapist
you mean India?
Anonymous No.107163181 [Report]
>>107162667 (OP)
This will change with C++26 Reflections.
Anonymous No.107163206 [Report]
Check out glaze for c++ json with their own reflection system.
Anonymous No.107163278 [Report] >>107163286
>>107163149
>rust tranny pedo's shill thread has already ended badly
like anon said, unless you're here to give tips on child rape or the best place to score cp, you have nothing to contribute. you're out of your league when it comes to making up lies about programming languages you've never used
Anonymous No.107163286 [Report] >>107164279
>>107163278
>like anon said
LMAO samefagging jeet wants to redeem Rust in a Go thread. KEK
Anonymous No.107163438 [Report]
>>107163071
take your meds schizo
Anonymous No.107163488 [Report] >>107163592 >>107163607 >>107163941
>>107162667 (OP)
You are the reason our software is so slow.
Anonymous No.107163583 [Report] >>107164782
if you serialize to JSON from struct to string through dynamic data structure you are a fucking retard.
All you need is a json writer that immediatelly puts strings into either some stream or growing buffer. the C code could easily look like this
void my_struct_to_json(struct json_writer *j, const struct my_struct *o)
{
json_object_begin(j);
{
json_key(j, "people");
json_array_begin(j);
for (size_t i = 0; i < o->people_count; i++) {
json_object_begin(j);
{
json_key(j, "name"); json_value_str(j, o->people[i].name);
json_key(j, "age"); json_value_int(j, o->people[i].age);
json_key(j, "marital-status"); json_value_str(j, o->people[i].marital_status);
}
json_object_end(j);
}
json_array_end(j);
}
json_object_end(j);
}

in comparison to nlohmann/json .dump() this approach is 8x faster and requires pretty much the same code
Anonymous No.107163592 [Report] >>107164491
>>107163488
you have 0 programming expericence
Anonymous No.107163607 [Report]
>>107163488
(not op)
i actually do enjoy knowing that consumerslop trash is a wholly inferior class of software
and you know what? i have no problem with writing shovelware either
im like
"yae bitsch. now smear it all over your face"
Anonymous No.107163855 [Report] >>107163925
>>107163071
>you shill java and python
I code in Rust, but I am a realist - no one needs speed of low-level language like C or Rust for some retarded parser or TCP listener or another audio player.
Anonymous No.107163892 [Report]
>>107162976
>>There is python and java that are much easier to write code with
>just install all this shit to run my code bro
>just autistically tweak $CLASSPATH bro til the Spring beans can be wired, bro.
>just run this UPX installer that is flagged as a virus (even if it isn't, sadly) for my python app bro

Easier? maybe? In all honesty, from a whole project lifecycle standpoint, go is a lot easier than python and java. only hard part is dealing with C ffi because of the Go runtime, but even that's solvable given shit like sqlite3 and gtk4 have bindings.

also note I hate go as well.
Anonymous No.107163925 [Report] >>107163931 >>107164399
>>107163855
both of those use cases can be solved with C# and Go as well. I still think Rust is the least shit at everything, but most people can't handle not having a GC and a mediocre type system.
Anonymous No.107163931 [Report] >>107163941
>>107163925
Rust sucks for non-immediate GUI applications
Anonymous No.107163941 [Report] >>107163969
>>107163488
no, reality is. hard problems come with trade-offs and most of the hardest problems are a fundamental law of the universe: the speed of light. users want features, eventually features become networked or IO bound in some way and all the optimistic copes will hit footguns eventually.
>>107163931
based on what? utterly deranged statement.
Anonymous No.107163969 [Report] >>107163977 >>107164029
>>107163941
borrow checker doesn't work well on callbacks, so you end up using shared pointers which means you might as well use a gc language anyway.
On top of that any use of third party package will result in a >1GB target folder
Anonymous No.107163977 [Report] >>107163988
>>107163969
Bevy, Iced, Gtk4
your statement is meritless and retarded.
Anonymous No.107163988 [Report] >>107164004 >>107164050
>>107163977
>Bevy, Iced
immediate mode
>Gtk4
https://gtk-rs.org/gtk4-rs/stable/latest/book/g_object_memory_management.html
>two buttons which both modify the same number. For that, we need a way that both closures take ownership of the same value?
>That is exactly what the std::rc::Rc type is there for. Rc counts the number of strong references created via Clone::clone and released via Drop::drop, and only deallocates the value when this number drops to zero. If we want to modify the content of our Rc, we can again use the Cell type

Looks like I win.
Anonymous No.107164004 [Report] >>107164020
>>107163988
win what? being retarded? you've never written a gui app in C++ or C and it shows. Not surprising you don't know shit about Rust either. Borrow checker just forces you to write your GUI correctly. that's it. fucking retarded faggot.

>nooooo you have to use refcounted heap allocated types
ya, just like in C, C++ or GNOME's Vala shit too. Wouldn't surprise me if Obj-C / Swift is the same, but never used them. I know a lot of things are refcounted ootb in objc though.
Anonymous No.107164020 [Report] >>107164030
>>107164004
Not true at all. In C you have Win32 api, no shared pointers.
In C++ you have FLTK, no shared pointers either

Rust has FLTK bindings, try using them without killing yourself :)
Anonymous No.107164024 [Report]
>>107162667 (OP)
If it was automatable it would be in a library. Are you talking about automating your type autism?
>json
I don't use json, but here is a program+programming language written in c the headers of which you could easily use. https://github.com/jqlang/jq/blob/master/src/jq.h

As for why we choose not to use libraries to solve trivial problems it's to let the reader/maintain know that the program isn't about manipulating json. Or rather that the basic primitives of the program are function that manipulate json, but not serialize. Hence you might need to know (what writing) toJson() but you don't need to know (what writing) serialize_struct() means further than the name and i/o
Anonymous No.107164025 [Report]
>>107162667 (OP)
>2-3 hours of free time every day after their work
We're writing C and C++ at work, not just after.
Anonymous No.107164029 [Report] >>107164051
>>107163969
>callbacks
HAHAHAHAHAHAHAHA
https://en.wikipedia.org/wiki/Functional_reactive_programming
Anonymous No.107164030 [Report]
>>107164020
>In C you have Win32 api
how do you think your win32 widgets work, dipshit? it's a message based architecture using refcounted state.
Anonymous No.107164050 [Report] >>107164064
>>107163988
>immediate mode
>iced
where is this stated? I'm on their website now. it looks like reactive style UI, so I'd be surprised if it would wastefully loop and do nothing. maybe that's the rendering backend doing that, but why?
Anonymous No.107164051 [Report]
>>107164029
>bro just clone your state every time to keep the function le pure, bro.
Anonymous No.107164064 [Report] >>107164498
>>107164050
It is not stated, I can tell it is because I have a faulty GPU driver which causes performance to drop to 1FPS on the desktop every time I want to drag or resize an OpenGL/Vulkan window.
(NVIDIA btw)
And yes, happens on iced. Doesn't happen with gtk
Anonymous No.107164096 [Report] >>107164248 >>107164282 >>107164699 >>107167363
>>107162678
You actually can, but GUIs don't exist anymore, they're all things like Electron now. Qt is the main "other" thing, and it's all ancient spaghetti slots and signals trash. Qt feels like it would be the niche hobby Linux distro some nerd tells you to use. It feels like shit, it doesn't feel like you're using professional software, and it's the main one.

It's moved to web dev to build GUIs and it is NOT just because loads of Indians know web languages. It's because HTML, javascript, and CSS are at least 1000000x more powerful for building user interfaces. It's just superior for making interfaces and it's genuinely not close.
Anonymous No.107164248 [Report] >>107164357
>>107164096
>It's because HTML, javascript, and CSS are at least 1000000x more powerful for building user interfaces
Lol no. You just reach every device.
Anonymous No.107164279 [Report] >>107164307
>>107163286
go is the jeetlang, rust filters jeets like you rapedeep
Anonymous No.107164282 [Report]
>>107164096
Swing/JavaFX won.
Electron is for pajeet.
Anonymous No.107164307 [Report] >>107164521
>>107164279
Roast is like wearing a seatbelt on a lawnmower. Also the lawnmower is trans
Anonymous No.107164357 [Report] >>107164394
>>107164248
You actually think there is a better method for creating intricate inferfaces? Web languages absolutely dominate the entire arena in capability. The competition is crushed... The competition is literally Qt which feels like an indie project. Where did Visual Basic go? GTK lol forget about that one.
Anonymous No.107164394 [Report] >>107165195
>>107164357
>capability
No.
>Reach
Yes.
This isn't even a real conversation. Am I being trolled?
Anonymous No.107164399 [Report]
>>107163925
I used java as a synonym for any language used in corporate environment.
Anonymous No.107164491 [Report] >>107164731
>>107163592
I worked with Apache Tomcat more than 10 years ago and guess what? That bloated piece of shit was so bad its market share has collapsed.
Anonymous No.107164498 [Report]
>>107164064
retard
Anonymous No.107164521 [Report] >>107164555
>>107164307
>muh tranny
C is the most tranny language
Literally implicit conversion anywhere just like trannies deciding to chop off xheir cock at any moment
Anonymous No.107164555 [Report] >>107164562 >>107164795 >>107165390
>>107164521
C is simple with a volcanic temperament, and just gets shit done. It's the digital embodiment of masculinity
Anonymous No.107164562 [Report] >>107164575
>>107164555
>volcanic temperament
>masculinity
kek, so the pajeet screaming DO NOT REDEEM is masculine to you? Temperament is a woman thing
Anonymous No.107164575 [Report] >>107164583
>>107164562
Tell Zeus God and general Patton that to their face
Anonymous No.107164583 [Report] >>107164593
>>107164575
>general Patton
the guy crying about asiatic Russians like some little girl? lol
Anonymous No.107164593 [Report] >>107164605
>>107164583
Patton, McCarthy, and Nixon were right about everything.
Anonymous No.107164605 [Report]
>>107164593
Men who act like little girls when they don't get what they want and throw tantrums
Anonymous No.107164699 [Report] >>107164733
>>107164096
this. pretty much everything I do I try and shove into a webpage first.
It isn't even that it's easier to use for UI dev.
It also removes needing to "install" anything which is its own burden. only shit deal is stateful stuff and dealing with games like IndexedDB being deleted infrequently or not. FS API is still being bounced around.
What I'd really like would be unix socket support in browsers (Yes even WIndows has unix sockets) and then I'd just have users start a webserver in the background or some shit for pure local apps.
Anonymous No.107164731 [Report]
>>107164491
>tfw still have to deal with it sometimes.
>tfw I'm the only person who vaguely knows how to tune, tweak and admin it
It's so fucking bad. self-contained servlet container > tomcat. you can put nginx or whatever in front to revproxy them instead as well. Java ecosystem is so fucking bad, it's unreal.
Anonymous No.107164733 [Report] >>107164746 >>107164865
>>107164699
>only shit deal is stateful stuff
>his programs have state
Anonymous No.107164746 [Report] >>107164878
>>107164733
I try really hard to remove them, but sometimes you still need something persisted if you want it to be a useful app. otherwise you'll carry it in your "cloud" or whatever, which is fine too for corpware.
Anonymous No.107164782 [Report]
>>107163583
iirc there was some online parser that generated nlohmann code from the struct definition so I used it a few times, now I use glaze
Anonymous No.107164795 [Report] >>107164813
>>107164555
>>and just gets shit done
why do people say this? if your app is retard simple, I guess? in practice, I see even the most diehard UNIX weenies shoe-horning shell shit, perl and awk everywhere instead of trying to write anything in C outside of the bare minimum. All the low level corporate software I've dealt with was in C++ as well. I rarely see C outside of microcontroller slop which could theoretically be done in C++ or Rust anyway, just no drive, tooling or need when most MC use is press button in STM Cube and writing a basic bitch control loop.
Anonymous No.107164813 [Report]
>>107164795
oh, I also forget lua is common too. rspamd just trades old timey spamassassin perl shit with lua. lose a lot of memory with that. not sure why people can't just write it in C++ or Rust or even Golang/C#... better than Lua or Perl anyway.
Anonymous No.107164865 [Report] >>107165386 >>107165500
>>107164733
What is this man's profession?
Anonymous No.107164878 [Report]
>>107164746
you took me seriously...
it's a stupid joke
Anonymous No.107165195 [Report] >>107165220 >>107165227 >>107165393
>>107164394
Have you used Qt? It's shit. Professional tools have built their own GUI from literal scratch like in video games etc. Qt tools are shit. QML is side-project tier. GTK is even worse. That's it... Anyone can create a better looking more functional GUI with HTML and CSS in a day than they could create with Qt in 3 months with its outdated crappy looking components and whatever.
Anonymous No.107165220 [Report]
>>107165195
You sound brown
Anonymous No.107165227 [Report]
>>107165195
i've been using fltk as a cross-platform base and modifying it to have the widgets i want
i can actually shove the entire library in my brain, unlike the sprawling expanse that are the major toolkit players
Anonymous No.107165386 [Report] >>107165969
>>107164865
he's an artist. he's a performance artist
Anonymous No.107165390 [Report] >>107165413
>>107164555
>saar look how smart i am for using c, its le no bloat and le pointers
Then go write Assembly instead nigger, instead of remaking the same fizzbuzz and asking for brownie points
Anonymous No.107165393 [Report]
>>107165195
don't forget the Qt upgrade treadmill. I've worked on projects that just died at 3 or 4 and never upgraded. I think they're up to 6 now and if KDE's buggy and crashy behavior is anything to go by, it isn't exactly easy to keep up with.

I don't understand the hype of Qt other than that it exists with "professional support" and some meme testing and design tools. even working with translations seemed ridiculously overly complex compared to GNU gettext and po files, though I think even KDE also uses gettext and po instead of the Qt translate tools.
Anonymous No.107165413 [Report] >>107165426 >>107165430 >>107165498
>>107165390
C is basically portable assembly with syntactic sugar.
Anonymous No.107165426 [Report] >>107165438
>>107165413
it literally isnt lmao
Anonymous No.107165430 [Report] >>107165438
>>107165413
>C is basically portable assembly with syntactic sugar.
no it isn't. stop repeating this lie. it will literally never be true.
Anonymous No.107165438 [Report]
>>107165426
>>107165430
Yes-sa
Anonymous No.107165448 [Report] >>107166148
>qt
>electron
RETVRN
Anonymous No.107165498 [Report]
>>107165413
the only syntactic sugar C has is indexing, where a[i] is exactly *(a + i)
otherwise i agree
Anonymous No.107165500 [Report]
>>107164865
He's a vile sodomite for hire
Anonymous No.107165608 [Report] >>107165728 >>107165730
required reading: https://queue.acm.org/detail.cfm?id=3212479&doi=10.1145%2F3212477.3212479
Anonymous No.107165641 [Report] >>107165668
In Rust this is just
#[derive(Serialize, Deserialize)]
struct MyStruct {
// ...
}

serde_json::to_string(&my_struct);
Anonymous No.107165668 [Report] >>107165684
>>107165641
In Rust this is just
$ du -sh target/
1,2G target/


>inb4 umm ... acktchually, serde is a deserialization framework not a deserialization library so it is normal that the size is so la-aaaa-aaaaaaa-AAAAAA-AAAAAAAAAAAACCCCCCCCCKKKKk
Anonymous No.107165684 [Report] >>107165695
>>107165668
the equivalent C++ project will be similar. I don't understand you retards. when I was doing fulltime C++ dev, the .clangd/ folder was multiple gigabytes as well. that's just the nature of the beast.
Anonymous No.107165695 [Report] >>107165714
>>107165684
golang makes 2MB self contained executable that is capable of deserializing and serializing json
Anonymous No.107165714 [Report]
>>107165695
that's great, go also has a NIH toolchain and also requires a GC'd, preempting userspace task scheduler as well, which makes it intractable. It's nice that their toolchain was built from first principles and they were able to deliver a good experience to their users, but my understanding is go build might get a "dev" and "release" flag potentially because the design can only go so far.
Anonymous No.107165728 [Report]
>>107165608
I love how author actually successfully establishes that C is a low level language and title contains the opposite for some reason
Anonymous No.107165730 [Report]
>>107165608
thanks.
>Computer science pioneer Alan Perlis defined low-level languages this way:
>"A programming language is low level when its programs require attention to the irrelevant."5

literally the best definition of low level I ever read too.
Anonymous No.107165969 [Report]
>>107165386
Interesting. What kind of services does he offer?
Anonymous No.107166148 [Report]
>>107165448
VGH...
Anonymous No.107167363 [Report]
>>107164096
>Qt is the main "other" thing
you mean java swing qt sucks because c++ sucks.