[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]


Previously >>100106518
What are you working on?
>>
>>100124886
>He's not even optimizing important parts
Not quite. They're the most important parts I have access to, but they only accounted for about 10% of the program's total runtime. On the other hand you're assuming that what I've learnt is only ever relevant in this specific program, and that is simply not true: >>100118611
>>
>>100124857
C, Rust, Haskell!
>>
>>100125175
stop grouping c with rust you fag
>>
>>100124828
I don't get why are you burning the system entropy on all this wild rejection sampling. But if you do it anyway, just double down. Something like,
static const ROLLCNT_PER_CALL = 5;
useful_range = floor(1.0 * RAND_MAX / maximum) * maximum;
poisson_lambda = 1 - useful_range/RAND_MAX;
assert(1 + poisson_lambda + 10*sqrt(poisson_lambda) < ROLLCNT_PER_CALL, "make ROLLCNT_PER_CALL bigger");
roll_cnt = 0;
do {
result = prng.next();
roll_cnt ++;
} while(result >= useful_range);
decoupling_cycles = ROLLCNT_PER_CALL - roll_cnt;
while(decoupling_cycles-- > 0)
prng.next(); // burn, burn, burn!
return result % maximum;
>>
>>100125375
>I don't get why are you burning the system entropy on all this wild rejection sampling
That's not how PRNGs work.
>>
>>100124828
No, but you can do it more efficiently: remap the PRNG output to a proper divisor of its output space close to the span of the range you want to generate (e.g. if it generates random u32s and your range is 10 to 100, then take it's output % 128 (nearest pow2 > 100 - 10), if its > 100 - 10 then generate again, otherwise return 10 + rng). It shouldn't matter anyway, for a PRNG to be good each call should produce a statistically independent number from the prior call, this is what PRNG tests like PractRand and TestU01 are meant to determine.
>>
>>100124857
What exactly is the point of writing assembly alongside any other programming language?
>>
>>100125296
this
c is deprecated
>>
File: 1695208333042848.jpg (495 KB, 1292x2533)
495 KB
495 KB JPG
Not sure if this is the right place to ask. Is it a common practice with postgresql to make an "abstract base schema"? Basically something other tables inherit from? for example Anime and Manga are similar in a lot of ways, would it make sense to make a "Media" table or something that the Anime and Manga tables both inherit from?
>>
>>100125858
Having issues with reality again?
>>
>>100125875
cope and seethe glownigger / useful idiot
>>
>>100125889
I'm not the one raging at reality, projector.
>>
File: Window Girl.jpg (197 KB, 1147x863)
197 KB
197 KB JPG
>>100125863
>7/11
Kinda clever.
>>
>>100125296
Yeah C is brainlet tier.
>>
>>100125977
I thought brainlets were the ones who needed handholding?
>>
why do you need a type system bro?
>>
>>100125863
No, that would be pretty stupid.
>>
>>100125296
Agreed, really wish people would just stop brining up c
>>
>>100126075
Duck typing is shit.
>>
>>100126075
only stupid people hate types
>>
>>100126135
Does it make you feel insecure?
>>
>>100125863
Pros:
1) You join media con anime and manga and get all data. New media will be new tables.
Cons:
1) You can represent abstract media that is anime nor manga.
2) You can represent media that is anime and manga.
3) You risk having shared attributes on media that future media will not use and will end up as nulls, empty, or on a separate table anyways.

Now, keeping anime and manga separate:
Pros:
1) Cons from above disappear. New media will be new tables.
Cons:
1) Your joins transform into a union all and an extra type column indicating the table where the data comes from. But now you don't need joins to query either manga or anime separately.

I wouldn't bother with a table that is an abstract class in this case.
>>
How do I query data from a table that belongs to a different schema inside a function trigger? I'm using postgres
>>
>>100126410
would it be better to have a Media table with all the common fields, and a type enum field thats either anime or manga? then have separate tables for anime and manga with their own unique fields? or should i just keep them completely separate?
>>
>>100126462
>would it be better to have a Media table with all the common fields, and a type enum field thats either anime or manga? then have separate tables for anime and manga with their own unique fields?
Type enums introduce redundancy and possible consistency problems. Instead, you put media_id (primary), media_name, media_rating and anime_id (primary), media_id (foreign), anime_length and manga_id (primary), media_id (foreign), manga_releases.
Still, deleting anime or manga means you need to enforce the constraint and go delete the corresponding media.
>or should i just keep them completely separate?
I don't see a compelling reason to merge them under media.
>>
>>100126398
No, but running software made in it does
>>
>>100126044
Yes thats why brainlets use C.
>>
>>100126655
So does Java and PHP, yet I hear no one complaining about them - probably because no one cares about insecurity except when it's a convenient strawman.
>>
>>100126743
>So does Java and PHP
That's caused by C too.
>>
>>100126693
Can you, like, get your narratives consistent? >>100126655
>>
>>100126758
That's not me. I said C is brainlet tier.
Also he's right too. Software written by cniles are not secure because these brainless can't get anything right.
>>
>>100126754
Why don't they implement Java in Java and PHP in PHP then, I wonder?
>>
>>100126783
Because Rust didn't come out back then, duh.
>>
>>100126771
That doesn't make them brainlets though, only conceited and overconfident.
>>
>>100126771
kek
>>
>>100126791
So Rust isn't written in C?
https://www.cvedetails.com/cve/CVE-2021-31162/
>>
>>100126803
>bug in libvpx
>blame Rust
As expected.
>>
>>100126806
>In the standard library in Rust
Nice try though.
>>
>>100126824
>libvpx is the standard library of Rust
As expected from cnile brainlets.
>>
>C cancer spreads bugs in PHP and Rust alike
>>
File: 1713397430486602.jpg (52 KB, 400x401)
52 KB
52 KB JPG
Is this the "Rust trannies seething about C" thread or is this the daily programming thread?
>>
>>100126832
Source?
https://github.com/rust-av/vpx-rs
>>
>>100126841
And the best thing is that there is absolutely nothing you can do about it. Absolutely nothing.
>>
>>100126864
https://github.com/rust-av/vpx-rs/blob/master/vpx-sys/build.rs#L20
>>
>>100126873
Except for uprooting cnile tumor bit by bit.
>>
>>100126880
And what does that have to do with standard libraries?

>>100126893
So when will Rust be written in Rust entirely?
>>
>>100126908
When they finish rewriting everything in Rust.
>>
>>100126919
So never, considering maintainers leave all the time?
>>
>>100126771
why do you even come here?
>C is brainlet tier
you say this everyday, meanwhile every audio and video decoders are written in C, how do you cope with that?
C is imperfect but there is no other choice, having to use it say abslutely nothing about you

no shut the fuck for christ sake I'm sick of hearing this brainlet bullshit. only brainlets waste their time insulting other people instead of doing useful shit
>>
>>100126945
Just like xorg? Oh wait lmao
>>
>>100126949
> every audio and video decoders are written in C
Not the best example if you want to shill C.
https://github.com/xiph/rav1e
>>
>>100126919
You will never be a woman.
>>
>>100126980
You will never be a real programmer.
>>
>>100126955
Red Hat and Gnome have deprecated Xorg, and even Xfce is slowly moving towards Wayland. It's over for them.
>>
>>100126983
Real programmers use C as it doesn't require handholding.
>>
>>100126983
If writing Rust means being a "real" programmer then I'll pass. You'll still never be a woman and your flesh wound will never be a vagina.
>>
>>100126994
If they didn't need hand-holding they wouldn't be using C.
>>
i've been working as a backend dev for like 6 years now and every year i like it less and less
don't really care for IT either, but it's got the best pay and it's not the worst thing in the world i guess
don't have any diploma beyond a high school degree so can't really get a non IT job

what do
>>
>>100127021
>then I'll pass
You will never pass. And you will never make it.
>>
>>100126994
C programmers need hand holding because they get filtered by the bc.
>>
>>100127023
Manual memory management is the definition of "no handholding", though.
>>
>>100126963
>The fastest and safest AV1 encoder.
this is the actual fastest
https://code.videolan.org/videolan/dav1d
I know that advanced decoders use assembly but C is you use for the non assembly pieces or for decoders not using assembly.
>if you want to shill C.
I don't. Why do I need to either shill it or shit on it? I'm sick of hearing the same retards/shills saying that every C programmers is braindead.
>Rust repo
what does that prove? ffmpeg and most audio/video codecs are written in C, just like I said
>>
>>100126963
are you aware that almost all repos of xiph are in C?
https://github.com/orgs/xiph/repositories
that's exactly what I said in my post
>>
>>100127044
>they need handholding because they don't like handholding
Yeah, you sound mentally ill.
>>
File: 1710692772468081.jpg (652 KB, 2048x2048)
652 KB
652 KB JPG
Is there some kind of nice middle ground between C and Python where you get a decent but simple IDE, good performance, no BS whitespace formatting, and plenty of easy to install libs? Purely for the purpose of making hobby-tier applications or games.
>>
>>100127135
>this is the actual fastest
Is there a benchmark?
>>
File: normies_get_frustrated.png (77 KB, 1844x477)
77 KB
77 KB PNG
>>100127787
No.
>>
>>100127787
C#?
>>
>>100127044
>filtered by the bc
Did you mean gc or is there some acronym I don't know about?
>>
>>100127833
any benchmark will comfirm this
dav1d is 200,000+ lines of handwritten assembly, nothing like it exists
>>
>>100128174
it's a rustroon thing
>>
>>100127787
Yep sounds like you want C#.

>decent but simple IDE
You can get started with VS Code. For more power look into Visual Studio or JetBrains Rider.

>good performance
Good enough.

>no BS whitespace formatting
lmao

>plenty of easy to install libs
https://www.nuget.org/

>purpose of making hobby-tier applications
Console apps, GUI frameworks like Avalonia, Xamarin or MAUI

>or games
Unity, Godot, MonoGame, Raylib-cs / SFML.Net / SDL2-CS in order of use-an-engine to code-everything-yourself
>>
File: team-standup-meeting.jpg (171 KB, 1241x698)
171 KB
171 KB JPG
(cross posting from /gedg/)

What were you working on last time?

What are you gonna work on next time?

Any blockers?

Include screenshot if possible.
>>
File: 1711847520275008.jpg (86 KB, 1137x860)
86 KB
86 KB JPG
I want to contribuite to some larger projects, but I don't know how
Im just a student with no working experience, how does one approach such a task? Should I just read the documentation, compile it from source and then try to solve bugs that are open on github?
>>
>>100129161
Pretty much, yeah. But you should triple-check everything and avoid issues that require design and architecture decisions because chances are the maintainers have their own vision.
>>
>>100108364
Your error is caused by the space you left between the i and the 1 in "str(i +1)"
>>
File: proxy-image.jpg (74 KB, 1440x810)
74 KB
74 KB JPG
>I can't merge arrays in asm ARM
>>
>>100129606
arm asm is pretty easy to write, what's the problem exactly?
>>
>>100129161
https://hacktoberfest.com/participation/#beginner-resources
https://github.com/MunGell/awesome-for-beginners
https://goodfirstissue.dev/
https://goodfirstissues.com/
>>
>>100129161
instead of immediately trying to solve bugs on your own, start by reading some already finished tasks and analyze how they have been implemented
that way you'll get some feel how solutions look like, then you can try solving something on your own
>>
>>100129627
nvm I'm a retard that can't read memory
>>
>>100129298
>>100129817
>>100129912
I thank you all for the answers
>>
>>100126075
this so this, we need enforced dynamic casting so that you have control over registers. The best programming language is assembler with more intuitive code blocks.

>>100126253
>.t lazy old man
>>
>>100127787
unironically sepple, there are too many libs though and you will have to treat every project as if it its own new language, kind of just like python
>>
>>100129606
>merge arrays
just copy shit over
>>
>>100124857
Since yesterday and probably for the next couple of days I am writing documentation for the x64 instruction set and logical units that handle specifc instructions because there is no good docs on the internet ('good' means instructions in opcode order and the full set of instructions).
>why
I have to write my current project and the one after (which builds on it) in assembly so since I will eventually have to go read up on the FPU and SIMD i might as well do it now and write code that goes as fast as possible,
>>
>>100124857
>F# has ASM syntax before Visual C++ cl.exe
what did .NET mean by this?
>>
>>100130848
https://uops.info/table.html
>>
>>100124857
how would I implement zoom on a mandelbulb rendered in a fragment shader? I can never quite get close to the surface the render shits itself or the step gets too big. Any ideas how to save the last distance? On the cpu I could just read the buffer but on a shader...
>>
>>100131190
Can't you have 2 FBOs with separate texture attachments and store the value at each pixel into that attachment FBO's and read the other FBO's texture as input, and swap the bound texture for each iteration?
>>
>>100131097
It isnt quite what i was looking for, I am halfway done but I will take any excuse to not finish this, there are some opcodes that are shared between 20 instructions because of prefixes and modrm.rm bs...like no seriously $217 is like fucking insanity.
Google + that will do the job, thank you Bro.
>>
File: VTxd0.jpg (775 KB, 3012x2129)
775 KB
775 KB JPG
>>100131384
>>
>>100125858
>C is deprecated
No language is ever deprecated.

>>100126398
NTA, but C makes me feel in power, even if I can be inept with it sometimes. Rust just makes me feel very insecure.
https://cert.europa.eu/publications/security-advisories/2024-035
>>
>>100130891
that literally everyone including microsoft employees knows that clang-cl is superior to cl.exe and it's better to work on modern tooling which isn't a mess
hadn't really thought of using
(which has multiple subdialects of inline ASM including a 64 bbit variant of cl.exe is superior to cl.exe (which does have it, both

>>100131190
shared memory, atomics, multi-pass algorithms with explicit before you hit subfragment size, i think the builtin derivative functions technically allow for communicating over the four lanes that make up a fragment
i'm confused though aren't fractals supposed to be pure functions? why would you need to save/restore values?
https://iquilezles.org/articles/distance/
https://iquilezles.org/articles/distancefractals/
https://iquilezles.org/articles/mandelbulb/
i will admit i've not got the background on the maths aspects of this, but the guy who made shadertoy (who does most of his shit entirely in fragment shaders) is using an analytically derived approximation of a distance function
and none of his zooming fractal shaders look like they're using any global state or double buffering, they iterate to a point where i assume they hit way past subfragment levels of precision then approximate the distance
>>
>>100132183
lmao that was a mess i forgot that first part was there
*hadn't really thought of using the functional langs to do assembly
*i might look into that, i can see them mapping extremely well to certain patterns in ASM especially for highly pipelined shit

*clang-cl which has multiple subdialects of inline ASM including a 64 bit variant of the original MS inline ASM and the ability to use LLVM IR as an assembly language
>>
>>100132183
>including microsoft employees
Considering that I trust absolutely no one working for Microsoft, and the fact that on the occasions where I gave clang yet another chance it couldn't eve compile a source that both GCC and cl.exe had no issues with, my conclusion is that cl.exe is superior to clang-cl.
>>
>>100132309
the fuck did you do to it to make it do that? i occasionally get ICEs and shit but that's because i exclusively use git builds of clang i make infrequently with as many bells and whistles turned on as i can (granted not like i have a choice anymore, neither gcc nor msvc can properly target amdgpu)
but MS uses clang-cl for a lot of their internal testing, how did you manage to break it and not cl.exe?
likewise there's some feature differences between clang++ (clang in gcc emulation mode) and gcc especially on the edges but there aren't many
and clang-cl (clang in msvc emulation mode) i think mostly has feature parity but struggles with some lesser used edge shit like some aspects of SEH
the only real world cases i ever ran into is clang being really really stupid about what /W4 and -Wall do and flipping on the irrelevant secret warnings causing /WX and -Werror projects to break, this one time i ran into a SEH edge case, and a couple of partially completed features git versions of the STL assumed clang fully had which got proper checks shortly after
>>
>>100132183
>that literally everyone including microsoft employees knows that clang-cl is superior to cl.exe
grim.
explains why the new Direct3D HLSL compiler is just a shitty ancient hack of clang that sucks nigger dicks and no one wants to upgrade to the latest clang/llvm
>>
>SFINAE bug in cl.exe that only seems to happen in the version that comes with Visual Studio 2022

I hate Microsoft so much, it's unreal. works with MinGW btw. done with this autism bullshit.
>>
>>100132670
>how did you manage to break it and not cl.exe?
Register allocations on GCC (clang doesn't like breaking ABIs) and export by ordinal on VS (important for DLL injections).
>>
>>100132776
Also works on windows 10, vs2019. I can't figure it out.
>>
>>100124857
i m trying to simulate a dataset for a project i m working on and i m writing the most horrendous python code, i want to know, does it even matter ?
>>
>MOVHPS
>MOVHPD
Why are these different instructions? it is not like the coprocessor would know that the values are not in the correct format, both instructions just move 64 bits from location A to location B.
>>
>>100132835
Python code becomes garbage in 2 years anyway
>>
>>100132755
good news
the latest versions of clang/llvm have had experimental first class DirectX/HLSL/DXIL support for at least a few months now
it's based off the C++ language mode with features turned off which is different from how they usually do it
don't think prebuilts ship with it though

>>100132827
>Register allocations on GCC (clang doesn't like breaking ABIs)
knowing clang it can but you have to either dip into clang's internal command line, llvm's internal command line, or have to dip into llvm IR
a lot of codebases doing hacky low level shit will just ship LLVM IR as inline assembly or whole files
>export by ordinal on VS (important for DLL injections)
isn't ordinal exporting done via export definition files making it a linker feature?
lld.link unlike clang-cl is not nearly at feature parity with the MSVC toolchain, far from it, the only reason people use it is LLVM's optimizer and it being so much faster
if you'dve paired clang-cl with link.exe it would've worked, i think it's just the hidden flag -fuse-ld=link.exe though i'd have to triple check the codebase to see which flag value actually causes it to use LINK.EXE
>>
>>100124857
I'm working on my actual job and honestly I've lost interest
I was working on a pure template transformer inference engine but I'm too tired to do that too.

Looks like I'm gonna work on taking a fat shit in a bit.
>>
>>100132183
msvc has faster compile times and excellent debug info emission (i have never encountered the "value optimized out" garbage you typically get on linux). it's actually quite good for debug builds.
>>
>>100133003
>internal command line
>just the hidden flag
>llvm IR
Yeah, I'll just stick with GCC/VS.
>>
>>100127787
Cshart maybe?
>>
>>100133123
without the sunk cost to justify it that's probably for the best
sometimes it seems like the llvm project hides shit just to hide it
>>
>>100126655
>>100126754
Fucking retards will never get it which is why this industry needs a filter.
- Your CPU is not "memory safe."
- Whether your code in C is memory safe or not depends entirely on your engineering skills. And if you can't write safe code in C, you literally do not belong in software engineering.
- Exploits related to managing memory are but ONE class of exploits.
- Old code is old and had lots of those exploits because no one was worried about it at the time + too many mouth breathers in this industry. Most of those exploits have already been exposed and cleaned out. New C code written by qualified engineers does not have those exploits. Statistically exploits are already shifting to other classes which affect most/all languages equally.
- Randomly replacing old, tested code with new code will NOT make it more safe, it will just increase the likelihood of other classes of exploits appearing in the code.
- C is used every where under the hood for a fucking reason.
- If C disappeared tomorrow, someone would have to invent something like C because C is used for a fucking reason. We need a language that's not assembler (unless you want more bugs/exploits) but also not as high level as other popular languages.
- "Muh Rust!" is not a solution. Without C you just end up writing "unsafe" Rust code because...wait for it...C IS USED FOR A FUCKING REASON. And at that point we're back to the engineering talent writing the code because the compiler can't save you. But then that's always the case because memory exploits ARE ONE CLASS OF EXPLOIT.

Safety is not a fucking language feature. It's a mindset and a minimum IQ, which too many "coders" lack. Now, I'm not against higher level languages, safety features in those languages, OOP, etc. Most of the code I've written has been in one of several higher level "memory safe" OOP languages. But I know why that doesn't work every where. Because when it's used, C is used for a fucking reason.
>>
>>100133307
cnile ramblings are fun to read but you gotta start facing the reality.
every line of code you write in C is a potential vulnerability. stop doing that.
>>
File: 1.png (1.11 MB, 752x1336)
1.11 MB
1.11 MB PNG
>>100124857
>What are you working on?
Helping incels find girlfriends

https://github.com/duolicious
>>
@100133341
No.
>>
>>100133389
What have I done to you that you hate me that much?!
>>
>>100131240
>>100132183
currently I am setting the camera on the cpu side so doing the whole fbo thing is kinda hard since I never really know where my center is.
I am trying to copy the marble marcher demo so I need a camera and therefore some form of zooming etc. reading the source isn't easy as well I never understood the way others model their camera in shader code..
>>
>>100133341
>low iq shit post response
As is tradition.
>>
Rust has won, C++ has lost, what's the best project to learn Rust?
>>
File: New_Project_3.png (247 KB, 900x900)
247 KB
247 KB PNG
I've been learning golang for a week, I made a small script that downloads images/gifs/webms from a 4chan thread, in their own folder, and it uses goroutines! It's decently fast.

https://pastebin.com/KBt5kK7r
>>
>>100132901
nvm i realized that the first moves bits 32-63 + 95-127 while the second does 64-127
>>
>>100133614
learn Haskell
>>
>>100133307
assembler would be super safe, the problem would be the time software would be in production for and also that in the field where security matters the most (servers) assembly is neigh-impossible to port.
>>
File: 6.png (633 KB, 752x1336)
633 KB
633 KB PNG
>>100133410
You can also find a bf if you're the kind of /g/entleman who wears programming socks.
>>
File: nukes.png (139 KB, 1848x514)
139 KB
139 KB PNG
>>100133763
I hate people in general.
>>
>>100133726
>assembler would be super safe
?
>>
>>100133307
That's a lot of cope, didn't read.C is deprecated tech from the 70s, stop worshiping it like a cult.
>>
>>100134102
just like writing C
simple as
>>
@100134102
Or else? Are you gonna cry?
>>
>>100127787
rust
>>
>>100124857
>pic
rdtsc does NOT correspond to cpu cycles on modern processors. The tick rate is independent of processor frequency (although the exact rate isn't defined and varies for each CPU).
It is also not guaranteed to be executed in-order, i.e. a bunch of instructions behind it might get executed before rdtsc is evaluated (and vice versa).

keyword: "constant-rate TSC"
>>
>>100134182
He asked for good performance.
>>
>>100134163
Good for you, writing C and Go feels like an insult to my basic intellect. So I will keep avoiding it.
>>
>>100134208
That's why he said Rust.
>>
>>100134372
Why is he lying though?
>>
>>100134354
Sorry you feel that way, but truth hurts.
>>
>>100134385
I mean, in some cases Rust outperforms C but that's too pedantic.
>>
>>100134397
>truth hurts.
It does. Can't imagine being a C cultist, life must be so painful.
>>
>>100134398
Are you excluding the doctored cases where compiler code generation is actively lobotomized?
>>
>>100134437
Nah, the lack of static dispatch lobotomizes C's performance, but conveniently enough, the C cultist brains are also lobotomized enough to never notice this.
>>
>>100134427
I'm not the one feeling conflicted about his basic intellect when writing C code, though. I'm the one feeling vindicated.
>>
>>100134469
>I'm not the one feeling conflicted about his basic intellect when writing C
Yes because just like C, your intellect is also primitive.
>>
>>100134465
>the lack of static dispatch lobotomizes C's performance
Is that before or after you count the lobotomization that polymorphism inflicts upon your code? Because I don't need workarounds for shit features.
>>
>>100134530
Sounds more like a sour grape, anon but enjoy your runtime ad-hoc type checking. So primitive.
>>
>>100134489
>cope for why life isn't painful for me even though he previously claimed it was:
>>100134427
>life must be so painful
>>
>>100134564
I see, you don't need to cope because your brain isn't advanced enough to notice how trash C is. Perfect recipe for cult brainrot.
>>
>>100134551
>implying his code relies on the RTTI stuff the compiler has to put into his code
Sounds more like sour grapes for you.
>>
>>100133726
>human beings don't make mistakes in assembler
>human beings always write memory safe code in assembler
Holy fuck this industry NEEDS A FILTER. This is why I hate the "C is unsafe" meme. Retards who don't even begin to understand the issue, much less computer architecture.

>>100134102
>has no retort
You concession is noted.
>>
>>100134615
lmao no it doesn't. Learn what static dispatch is, but I don't have high hopes for you.
>>
>>100134598
This should be fun...tell us why you think C is trash without resorting to memes.
>uh...uh...it just is ok! my 1970s! MUH PDP-11!!!
>>
x is a value between 0 and 100
y is a value between 0 and 50
as x gets to the middle of its range, y reaches its max value; as x progresses
past the median, y recedes to its minimum value
if x is max, y is min; if y is min, y is min; if x is median, y is max
if x is 50, y is 100
if x is 25, y is 50
if x is 75, y is 50
how would you accomplish this in your language of choice
>>
>>100134598
How come trash is consistently faster than anything else, with the exception of hand-written machine code then?
>>
>>100134633
>>has no retort
I don't argue with cnile brainlets. I insult them. Their cultbrain is too primitive to argue on a technical merit, see >>100134654
>>
>>100134659
Decades of compiler engineering.
>>
>>100134385
Why are you lying?
>>
>>100134638
Why would I? I don't need polymorphism cope.
>>
>>100134678
Then I'll stick to C, considering that we have so much experience with it.
>>
>>100134662
>no argument
And that is exactly why everyone competent is laughing at people who're too dumb to use C.
>>
File: 1711444612375.png (449 KB, 1648x1010)
449 KB
449 KB PNG
>>100134717
>I don't need polymorphism
This is why I say C is an insult to my basic intellect.
>>
>>100134768
holy midwit
>>
>>100134762
Why would I argue with someone too stupid for argument?
>>
>>100134662
>literally no argument
As is tradition.

>>100134678
>muh compiler engineering!
The same compiler optimizations are used with every other decent language. Yet C is generally faster at any optimization level, including off.

If you actually understood computer architecture and ever worked in C, you would know why C is generally faster.
>>
File: 1534821778527.png (502 KB, 1200x1400)
502 KB
502 KB PNG
>>100134782
>filtered by static dispatch
>calls others midwit
And this is also why I hate cnile cultists.
>>
>>100134768
>noooo every solution must be oop
I love OOP. Most of the code I've written has been OOP. You do not always need OOP, and OOP does impose a speed penalty.
>but muh statically linked method!!!
If all your methods can be statically linked then you're not actually writing OOP code.
>>
File: 1713238261221262.jpg (5 KB, 215x235)
5 KB
5 KB JPG
>>100134797
>muh argument
As I said, I don't argue with cnile brainlets, they are literally and utterly too stupid to argue on technical merits.

I bring up static dispatch, cnile brainlets think it incurs RTTI >>100134615

Give me 1 (ONE) reason to argue with monkey retards instead of lazily insulting them for my pleasure. I'll wait.
>>
>>100134823
This picture has nothing to do with OOP.
>>
>>100134768
Nah, this looks like code someone like you would write - a.k.a. they're the same type of incompetent that would write doctored benchmarks to claim that <insert language here> is faster than C. Your cope is just say.
>>
>>100134808
>you dont use my midwit tools, therefore you must not understand them!
i understand templates and template """""metaprogramming""""" just fine bro, they're nothing special. what they are is a source of terrible error messages, terrible compile times, and midwit software architecture. people who do picrel don't actually know how to program in C, they hold it like it's C++.
>>
>>100134857
>what they are is a source of terrible error messages
Because C++ ""templates"" are not maximally constrained, thankfully Rust Generics are. Which is why it has better error messages. Thank you, Rust.
>>
>>100134836
>implying the compiler always knows what type a given object has
When was the last time you've actually tested if something is statically dispatched - a.k.a. disabled RTTI? Or would that dispatch your illusions that compilers are magical?
>>
>>100133872
>>100134633
human beings do not make mistakes when writing assembler, we need a filter for retards like you.
>>
>>100134887
the problem of slow compile times and midwit software architecture remains.

come on, bruce.
>>
>>100134909
Stop using cum crusted memepad and leave the actual development to employed individuals.
>>
>>100134901
>human beings do not make mistakes when writing assembler
So when was the last time you wrote more than 20 consecutive mnemonics yourself? Because I call bull on your shit.
>>
>>100134658
have a variable that is 0 and gets set when y is 50 to never be touched again and just keep on going. Are you retatded?
>>
>>100134916
crazy how after years of language trolling on this website and others, you still have the same crap opinions you did back then. pathetic, really. haven't learned a thing.
>>
>>100134945
Yeah, that's the difference between actual developers and fakers - the former understand what is going on behind the scenes and stop trusting compilers. The latter refuse to learn and become terminally dependent on their memelang.
>>
>>100134945
I only give "crap" opinions in response to already shitty opinions i.e. "we need some kind of a filter" etc, because that sounds funny from an actual brainlet. Learning C does not make you special. At least bootcamper retards can shit out something useful i.e a website/app but cnile snowflakes are literally useless.
>>
(define (take l n)
(cond
[(or (empty? l) (= n 0)) '()]
[else
(cons
(first l)
(take (rest l) (sub1 n)))]))
>>
File: brainlet.jpg (8 KB, 216x233)
8 KB
8 KB JPG
>>100134918
like yesterday? i think you are just retarded honestly.
Also inb4 "you have never programmer graphics", we were talking about memory and most code does not require fucking simd. If you segfault or leak while writing assembler you are literally picrel tier.
>>
>>100135006
>Learning C does not make you special.
Considering how many rage against manual memory management: yes. Yes, it does.
>>
>>100135014
Point to me the post that "rages against" manual memory management.
>>
>>100135036
point me to the one difference between c and rust that is not manual memory management.
>>
File: mnemonics.png (12 KB, 510x658)
12 KB
12 KB PNG
>>100135012
>like yesterday?
Show code then.
>>
>>100135006
>cnile snowflakes are literally useless
only in your delusional view of the world. if you look at things objectively, competent c programmers are the only thing keeping the modern software that you rely on from deteriorating into complete and utter salvageable garbage.
>>
>>100135050
Of course. Rust has:
- Strictly superior name-spacing and modules resolution
- Strictly superior macros
- Strictly superior ownership and lifetime model
- Strictly superior useful abstractions
- Strictly superior static dispatch and polymorphism mechanism
- Better and more readable syntax
- Cross platform tooling so you don't need to buy MSVC or CLion to be meaningfully productive

>>100135093
>competent c programmers
Oh like maybe 3 of them in the whole world and all in their 50s.
>>
>>100135125
Nah, it doesn't take much: https://www.rfleury.com/p/untangling-lifetimes-the-arena-allocator
>>
>>100135125
no point was being made about how many of them there are, you said they were all useless.
either way, no. competently programming in c isn't actually that hard. people just don't teach it properly unfortunately, so it ends up being the case that the ones who are competent are:
1) smart enough to hone their skill to a level where they are competent
2) interested enough to keep honing their skill
3) experienced enough to have spent enough time honing their skill to be competent
my thesis is that you can massively lower on 3 and lower the bar a little on 1.
>>100135152
this is a good post but always be mindful of not taking dogma from any side. arenas are very useful of course but they are not the end-all-be-all like I've seen this guy more or less aggressively argue on twitter. remember that programming is not a tribal activity. do whatever is most suitable for your program.
>>
So we just don't do programming here, we argue programming
>>
>>100135276
Does the char limit not tell you something about how useful these threads are meant to be?
>>
>>100135276
semantics is 50% of programming
>>
>>100128153
>>100128601
>>100133262
I might give C# a chance then, sounds like a lot of options available in terms of game engine shit which is pretty much what I want. Thanks anons.
>>
>>100135268
>they are not the end-all-be-all like I've seen this guy more or less aggressively argue on twitter
I don't read X (formerly known as twitter), but arenas have a very nice side effect to them: they don't allow you an easy way out. You can call malloc and free at any point in your program, their state is hidden, and the only parameters you ever pass to the functions are the size of the chunk you want to have allocated and the pointer that was returned by malloc in the first place. With arenas that doesn't apply; YOU have to make the decision how, when, and where that memory is being reserved, and how, when, and where it's being freed again. That in turn forces you to think about your memory management, and that leads to better program design as memory management is intricately tied to program design.
>>
>>100135276
Don't blame me. I'm not the one not providing one iotas of code ITTs:
>>100134986
>>100135055
You'll notice that the "C is shit" posts cease whenever I come in with code, probably because said shitposters are nocoders themselves.
>>
>>100135334
yeah, i agree it's important for programmers to think about where their data is. so much of perf is just memory layout nowadays.
ive also found clarity in thought regarding memory management leads to better and simpler software in general (this is in some way in duality with my argument that templates encourage midwittery, carefully thought-out things made precisely to solve a specific problem always win against sloppy things).
this is also why think refcounting schemes are especially poisonous, they're not just a poison to perf, but also to the mind in a way -- suddenly you have no idea what the fuck is going in your program: when is this thing freed? uhhhhh idk man, when it stops being used i guess...
>>
>>100135369
What code?
>>
>>100135527
I linked to it, blind-kun.
>>
>my code that is not correct and extremely unsafe is fast!!
yes it is grandpa, off to bed now
>>
>>100135369
>You'll notice that the "C is shit" posts cease whenever I come in with code
Honestly, you have the same posting style as the micro-optimization guy, the Cniles-are-retards guy, and that one guy that responds to any mention of Rust with YWNBAW. I just assumed that this was a bunch of sock puppetry.

I only feel reasonably sure that you are not that maid person, who might be genuinely mentally ill (or has done his research and never breaks character).
>>
I hear in twitter that F# is making a come back.
Really excited for this.
>>
>>100125340
how do you identify garbage?
by it's smell
how do you make the computing machine learn?
you get garbage
bad training data can be good training data.
its' midwits that must die, in any situations
>>
>>100135761
>you have the same posting style as the micro-optimization guy
I'll say, he's me.

>Cniles-are-retards guy
>any mention of Rust with YWNBAW
>that maid person
In contrast they're NOT me.
>>
>>100134836
>i said i don't have an argument
We know, you don't have to repeat yourself retard.

>muh static dispatch!!!
If all your methods are statically linked/dispatched then you're not really using OOP. So why are you smarting off when an anon says "I don't need polymorphism for my work"?

>give me a reason to defend muh shit posts!!!
You can't defend them, so why bother. The irony that you mock "cniles" when you're a God damn idiot.
>>
>>100135868
no one cares faggot
>>
>>100134901
>t. never wrote assembler

>>100135014
Nailed it.
>noooo i can't manage memory
>"i can"
>OMG C DOES NOT MAKE YOU SPECIAL
>>
>>100135930
You know you won an argument when the deranged retard you are talking to has to put words in your mouth to be able to grasp on the straw.
>>
>>100135334
>it's better because it's more work
stop making arena alloc sound bad, midwit
>>
Can you even slice strings in C yet?
>>
>>100135959
You have not presented an argument. In fact, you seethed when asked to present one. Which means you lost by default.
>noooooo
>cnile!!!!
>>
>>100136021
Why would I waste time in arguing with a fucking brainlet that cannot discern OOP and static dispatch? Fuck off back to your fizzbuzz faggot.
>>
>>100136037
>nooooo muh name calling!
>MUH INSULTS!!!
>DON'T ASK ME FOR AN ARGUMENT
Exactly.
>fizzbuzz
You couldn't even write that. Why are you shitting up this board? Fuck off.
>>
>>100135936
Your brains would look good on a mallet.
>>
>>100136012
lmao no, cniles will say "char* is all you need" and then proceed to make off-by-one errors and out of bound errors
>>
>>100136012
Sure. The question always was where you store the pieces.
>>
File: ac6.jpg (60 KB, 385x390)
60 KB
60 KB JPG
>>100136061
kek thanks, I'll stick to Rust.
>>
>>100136050
Arguing with cniles is like talking computer science to brainlet monkeys.
>>
File: 1695178502611922.jpg (85 KB, 618x679)
85 KB
85 KB JPG
>>100136097
And don't come back until Rust beats C in non-synthetic benchmarks.
>which is never
>>
File: 1713151494524998.png (573 KB, 1648x1010)
573 KB
573 KB PNG
>>100136111
>And don't come back until
I don't intend to come back LUL
>>
>>100136139
You've already come back ITT: >>100134768
>>
>>100136149
>cnile reading comprehension
lmao you know what they say, cniles are low IQ retards
>>
convinced at this point that bruce is an LLM
this guy gets his memory wiped every 30 minutes, incapable of learning anything.
>>
>>100136170
>no argument
Your brains would look good on a mallet, too.
>>
>>100136200
>no argument
It's not arguable, it's a fact.
>>
>>100136211
Only if you're mentally ill, which is why I don't feel bad about the thought of feeding you your own brain matter.
>>
>>100136255
whatever lets you sleep at night, champ :^)
>>
>>100136290
Thoughts of your torture? Sure, I love 'em.
>>
>>100136037
>cannot discern OOP and static dispatch
Let's dive into this since it is the only "argument" you've offered. Looking at your post history:
>>100134465
>Nah, the lack of static dispatch lobotomizes C's performance
Pretty much everything is "statically dispatched" in C because C does not have OOP. If you call myFunction() the compiler emits code that jumps to the address for myFunction() every time it is called. If you are rolling your own polymorphism/OOP via function pointers you probably need C++ and not C.

The fact that you don't know this tells the rest of us how little you actually know while you shoot your mouth off.

In an OOP language static dispatch means the compiler can figure out the exact function to call at compile time and emit code which jumps straight to it. If the function call depends on a parameter that can only be known at runtime then the function is called via a lookup table, dynamic dispatch. There are ways to get polymorphism in C++/Rust and end up with static dispatch on those functions (i.e. generics). But it's rather limiting. If you're actually using OOP and polymorphism the way it was intended to be used (classes/instances/inheritance), most function calls will be dynamically dispatched.

Now if someone purposely implemented their own OOP in C you could end up with an example where C++/Rust out performed C due to those compilers being able to optimize away some dynamic dispatches to static ones. But a C developer wouldn't design a C program like that. So all his function calls would be static dispatch, giving C the advantage over a solution where most calls are dynamically dispatched.

Which is why the other anon said to you:
>>100134530
>Is that before or after you count the lobotomization that polymorphism inflicts upon your code?

You understand NONE of this. And yet you shoot of your mouth. It's fascinating to watch.
>>
>>100134658
fn foo(x: u8) -> Option<u8> {
match x {
0..=50 => Some(2 * x),
51..=100 => Some(100 - (2 * (x - 50))),
_ => None
}
}
>>
>>100136319
>Pretty much everything is "statically dispatched" in C because C does not have OOP.
What exactly does OOP have to do with static dispatch? Why do you constantly bring this up? really would love to see how a brainlet's mind works.
>>
>>100136314
least unhinged cnile :^)
>>
>>100136381
Just look into a mirror. There's a brainlet right for you to observe.
>>
>>100136431
>n-noo u!
Yeah as I thought. Imagine even considering engaging with a cnile in hopes of a technical argument lmao. Just point at them and laugh.
>>
File: file.png (336 KB, 798x644)
336 KB
336 KB PNG
>C
>>
>>100136461
I'd love to be the one who hammers your IQ down into negative range on national TV.
>>
>>100136381
>literally explain static and dynamic dispatch to this retarded faggot
>"HURR BUT WHAT DOES IT HAVE TO DO WITH OOP???"
For fuck's sake, STOP posting and go read something to educate yourself. Even Wikipedia could help you.

>hurr you're a brainlet
You're the one who said, and I quote again:
>Nah, the lack of static dispatch lobotomizes C's performance
You claimed that a language where EVERY FUCKING FUNCTION CALL IS STATICALLY DISPATCHED is slow for lack of static dispatch. Think about that for a moment. Think about how stupid you look right now.

I wouldn't normally be this harsh, but you brought this on yourself by shooting off your mouth.
>>
>>100136509
>EVERY FUCKING FUNCTION CALL IS STATICALLY DISPATCHED
lmao calm the fuck down, you impotent rage brainlet. When I say static dispatch, I mean static polymorphism aka monomorphism - which C lacks, which is why your brainlet cult uses type erasure in form of void* and emulate RTTI to resolve the type. Then you wen on some schizoid rambling about how not to trust compiler etc and I started mocking you again.
>I wouldn't normally be this harsh, but you brought this on yourself by shooting off your mouth.
Your harshness is entertaining to me, similar to the noises chimps make inside the cage.
>>
>>100136493
>TV
Take your meds boomer
>>
>>100136551
My mallet and your cranium are a match made in heaven.
>>
File: maxresdefault.jpg (156 KB, 1280x720)
156 KB
156 KB JPG
>>100136590
>>
>>100136615
Yeah, picrel is my end goal for you.
>>
File: chimpanzee.jpg (967 KB, 2500x1667)
967 KB
967 KB JPG
>>100136631
Now that you got knowledge-checked, getting angry is what your monkey brain can afford. Every single day, my theory that cniles do not deserve a fair argument gets reinforced.
I see cniles are angry chimps, making chimp noises and throwing shit at each other. So primitive yet entertaining.
>>
do not engage in excess with a lolcow lest you become a lolcow yourself
>>
>>100136661
Thumb-thumb-thumb.
Those are going to be the last noises you'll hear before descending into eternal mental fog.
>>
>>100136551
>lmao calm the fuck down, you impotent rage brainlet. When I say static dispatch, I mean static polymorphism
No, you said:
>Nah, the lack of static dispatch lobotomizes C's performance
Again, EVERY dispatch is static in C.
>aka monomorphism - which C lacks
Exactly. A C program cannot be slow due to the lack of static polymorphism since it doesn't have polymorphism. A C programmer would design a solution that doesn't rely upon polymorphism. Polymorphism is not a requirement for writing any program. It is a programmer abstraction for convenience. So again: your claim that C is slow for lack of static dispatch is utterly retarded and false. It shows that you do not understand C at all, why it is used, where it is used.

This is what the other anon was getting at. Now I don't fully agree with him. I like polymorphism and OOP. But...I know there are times when you don't use it, when every cycle counts and you grab C and write a proper C solution. Or maybe even assembler. Why? Because I've had to do both many times for performance. C is not slow. C can be incredibly fast.

>hurr i'll call you a chimp
Hilarious in light of how stupid you are being.
>>
>>100136661
>hurr i'm talking to one anon
You haven't checked anyone. You're just back peddling from your retarded statement.
>>
File: 1713664349522182.png (508 KB, 1200x1400)
508 KB
508 KB PNG
>>100136693
>since it doesn't have polymorphism
C does have polymorphism. You don't know C enough yet to defend C. And the way to achieve polymorphism is through type erasure, which incurs RTTI overhead.
Unless of course, if you hand-write every single structures and methods, funny how pic related meme is the only line of defense cniles when it comes to the lack of monomorphism.

>when every cycle counts
Then use NASM, C is too high level for that. Don't pretend C programs are not compiled with -O2.
>>
>>100132835
write once, run once, update never
>>
rust-trannies not only seem to be getting less sane, but they're also infecting the cniles
>>
>>100136746
Torture. That's all you deserve.
>>
>>100136806
The Lisp weenies were right, garbage collection preserves your sanity.
>>
>>100136833
what is it with you trannies and fantasizing about harming those who simply disagree with you
>>
>>100136860
there's a reason productive people worth in java and python
>>
>>100136746
>>since it doesn't have polymorphism
>C does have polymorphism.
If you roll your own. Again we come back to: if you're doing that on a large scale, you might be in the wrong language for the project.

But even then: hand rolled polymorphism in C probably isn't going to be the thing that determines overall program speed. And there are a lot of places where C can pull ahead of a real world C++/Rust solution despite their polymorphism-aware compilers.

>You don't know C enough yet to defend C.
15 minutes ago you didn't even know what "static dispatch" was or why someone would associate dynamic dispatch with OOP. Your ego is that of a...oh wait, I've figured it out. You're a pajeet, aren't you?

>Unless of course, if you hand-write every single structures and methods
It would blow your mind to know how many applications have been written without anyone ever employing any kind of polymorphism.

>>when every cycle counts
>Then use NASM, C is too high level for that.
Why? Because it "lacks static dispatch?"
>lmfao
>>
>>100136901
>java
>"productive"
Good morning sir!
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
>>100136196
they wouldnt want their ai to become racist and homophobic.
>>
>>100136907
Bro stop lecturing me about static dispatch if you didn’t even know about the existence of polymorphism in C.
>RTTI is faster than static dispatch
lol it’s like I’m talking to yet another retard.
>>
>>100136914
>9+ years old "joke"
>not actual enterprise code, but what a second-year student thinks enterprise code looks like after being taught by a dead-ended academic professor with no real experience what he thinks enterprise code looks like
>doesn't even compile
>>
>>100137033
>Bro stop lecturing me about static dispatch
I wouldn't have to if you understood it.

>if you didn’t even know about the existence of polymorphism in C.
That you can roll your own polymorphism in C does not mean C "has polymorphism." You use C for performance. If you need polymorphism on a large scale you're in the wrong language. Nobody is writing entire C applications around function pointers, lookup tables, or type erasure. So those things do not limit or define C's performance. And even if you are doing those things, depending on what else your code is doing there's a good chance it will still end up faster than C++/Rust.

Your "argument" hinges entirely on doing things the opposite of the C way in C, while explicitly avoiding any code which would result in dynamic dispatch in higher level/more dynamic languages. Which is of course retarded, just like your original claim that C has poor performance.

If you need polymorphism, use a language that clearly and directly supports it. If you need best possible performance, you're not employing polymorphism application wide, so use C. For the vast majority of applications C++/Rust are just fine performance wise, quite good in fact, far better than Java, Python, etc. C is when you really have to optimize shit.
>>
>be me
>10+ year dev
>enter compsci course because why not, it's supposed to give me a better job
>first assignment
>have to write a text about "notional machines"
>ok whatever
>start researching
>it's some bullshit so stupidly abstract that no one can actually define it
>it's just metaphors on top of comparisons on top of abstractions
>it's not actually anything
I was ready to lower my standards and write javascript and python for the greater good but this is retarded
>>
>>100137067
>joke still hits home so hard pajeet needs to defend java
Java is shit. Sorry. It could be a productive language, the syntax and features aren't bad. It's the style of OOP that grew up around it. That and the JVM. I've seen too many Java "solutions" that ran like shit and had massive over engineered frameworks where a simple solution would get the job done.
>>
considering trying to write a very goofy clang plugin that lets you run subinvokations of the compiler in incremental/jit interpreter mode in a consteval context of the parent invocation and providing compiling programs safe access to the state of their own compilation
figure it's easier to just give constant evaluated code access to the entire compiler API than to write some complex abstraction over it
in theory i think i can do it safely
>>
Answer to euler #29 with an upper limit of 1k and 10k? Getting 995968 and 99973795
>>
File: 1620959278062.jpg (9 KB, 229x220)
9 KB
9 KB JPG
>>100137214
so, the cat's out of the bag
>filtered by OOP
>>
>>100135858
>bad training data can be good training data.
translation:
low quality content can be useful training data for recognizing low quality content.

>>100135868
I see. Have you ever thought about writing a compiler yourself? I am writing one for my own language. I have no idea what I am doing, though.

Also, how many people are actually arguing? Usually I like forced anon, but right now I wish I could filter at least two or three people? It's hard to tell offhand and I don't want to expend the energy towards that right now.

But, if people are arguing about polymorphism, I would like to hear opinions about double dispatch (for an example of the problem, see https://gieseanw.wordpress.com/2018/12/29/stop-reimplementing-the-virtual-table-and-start-using-double-dispatch/ ).

I think the interaction between Animal and Person belongs outside of both and the info governing the interaction should be in one place, but it still requires type information not present at runtime without an extra step.
>>
>>100124857
My function takes 25s to run in a debug build and 20ms to run in a release build. The 20ms in release mode is acceptable, but obviously 25s is way too fucking long to be waiting on each iteration.

How can I unfuck myself besides separating this function out into its own -O3 library so I can build the rest of my program without waiting 25s each iteration?
>>
>>100137320
>oop is a jeet filter
>not a jeet honeypot
Pajeets are terrible at it, but it doesn't filter them at all. They just call bad code good. And Java has always been known as an H1B/offshored pajeet language. Hence my problem with Java is not OOP, but shit OOP.
>>
>>100137393
>Have you ever thought about writing a compiler yourself?
No, and I barely see a reason to do so either. As long as a compiler comes with inline assembly support I can work around most shitstains that a compiler leaves for me. The only thing that has been bothering me somewhat is loop unrolling behavior in GCC.

>Also, how many people are actually arguing?
Dunno. I'm the regger guy who's into micro-optimizations, and that's about that.
>>
>>100137533
you're blaming the language for people writing shit code
shit code will be shit no matter the language or paradigm
just imagine how much worse all these pajeets' code would be if they wrote C instead of Java
>>
>>100134768
I'm not good with C, but shouldn't it be
if (sizeof(*key_v_ptr) == ...)
>>
>>100137676
Mate, the code is obviously bogus. They're checking for sizeof(byte) and sizeof(char) right after another: >>100134851
>>
>>100137649
>you're blaming the language for people writing shit code
What else can you do when so much of the ecosystem is shit? That said, I have other problems with Java. The jvm is shit for performance, and the entire mindset resulted in non-native GUIs which is why it never went any where on the desktop.
>>
>sizeof(int)
taking the code seriously
wake up

>that parody is the best rusttrannies can do
ywnbarealprogrammer
>>
>>100137649
You can write shit code in any language, but some languages make it easier to write good code than others.
>>
>>100137649
java encourages/encouraged dogshit oop code in the language itself
>>
>>100137784
>so much of the ecosystem is shit?
which part exactly? java has a stable ecosystem of frameworks and libraries on which huge applications run for years
contrast this with webshit frameworks that are born, completely change their APIs a few times, then die because something else got popular, all spanning over mere months
>The jvm is shit for performance
go ahead and name your use case where the performance is 1. "shit", 2. significantly different than other runtimes
> the entire mindset resulted in non-native GUIs which is why it never went any where on the desktop
main mindset for Java are enterprise web applications, with a web interface
there are GUI libraries for Java, even with native-looking themes, but your assertion why no one uses them is just silly
>>
How to piss off everyone by getting around C++ access specifiers:

template <typename Tag>
struct NameableEntity {
// ADL can find this overload since it is a friend
friend auto getFriend(NameableEntity<Tag>);
};

// Instantiation of this template will define the appropriate overload of getFriend
template <typename Tag, auto PrivatePointer>
struct StealPointer {
friend auto getFriend(NameableEntity<Tag>) {
return PrivatePointer;
}
};

template <typename Tag>
auto getPointerByTag() {
return getFriend(NameableEntity<Tag>{});
}

struct X {
private:
int m;
int n;
};

// Explicit template instantations don't check access levels of members
// Exploit this to get a pointer to a private member
struct XMTag;
template struct StealPointer<XMTag, &X::m>;

struct XNTag;
template struct StealPointer<XNTag, &X::n>;

void touchSomePrivateParts(X& x) {
// Presto!
int X::* mPointer = getPointerByTag<XMTag>();
x.*mPointer = 4;
int X::* nPointer = getPointerByTag<XNTag>();
x.*nPointer = 5;
}


https://godbolt.org/z/sKPefcGzs
>>
>>100137836
if anything, Java doesn't "encourage" or force OOP enough
most shit Java code I've seen is exactly the result of shitters filtered by OOP trying to do everything they can to avoid OOP, which then negate any advantages OOP could have given them
overengineering/overdoing with OOP is really a marginal number of cases of bad code compared to deliberate avoiding of OOP

>>100137815
other languages completely don't give a shit about writing good code
languages like C or C++ actually promote the most unreadable and ugliest of hacks, as long as they're fast
at least the Java ecosystem develops some principles, even as "controversial" ones as clean code and SOLID
>>
>>100138040
yeah we've all seen that youtube video
>>
>>100138069
Which channel posted this video with this technique? Did it use the
reinterpret_cast
bullshit?
>>
>>100138243
https://youtu.be/SmlLdd1Q2V8?t=494
>>
is it a pain in the ass to design a plugin system?
>>
>>100138363
not really if you choose to embed lua/javascript/python
>>
>>100138363
The only difficulty is the compartmentalization of tasks. The rest is learning how to dynamically load in libraries:
https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya
https://linux.die.net/man/3/dlopen
>>
>>100138363
Just use rPC over TCP what’s the problem
>>
>>100138363
nah
there's dozens of different ways to do it, from expecting extension libraries to conform to a given ABI, exporting a scripting interface from your program, some sort of client/server setup
you could even just let people dump shit into a rwe buffer
what clang does is to export some sort of registry symbol from an executable and have shared libraries create a static global whose initializer calls the registry function with plugin info
>>
https://twitter.com/rflaherty71/status/1782264148107137367
why is this guy saying that mmap is horrible?
>>
>>100138720
He's not giving any reasons, but his statement:
>I wonder if these people have ever solved a problem where they had less memory than data
clearly shows he's a retard, considering that the traditional malloc/free approach uses some of the memory it allocates from the kernel for its own state (which is why buffer overflows tend to be ... flavorful). On top of that swapping and paging exists, so that line of thought goes nowhere either.
>>
>>100138777
yea he is super weird
look at this tweet and try to not to laugh
https://twitter.com/rflaherty71/status/1782478999173648541
>if you ignore the biggest difference (and the best feature) of arena its just malloc lol
i know database people don't like mmap because kernel doesn't have enough information to know which pages are actually useful to you and which ones bring to memory from disk and you are much better off doing it manually i guess thats what he is talking about
>>
>>100138720
adding a page to your process' page table takes nothing, finding a usable block in a fragmented heap takes a while.
>but its le syscall
its 2024,. those cost literally nothing.
>>
>>100138842
writeback is not done by the processor, wether the addresses are on a swap or ram makes no difference
>but the memory fence
its 2024, we are multithreading bitch who cares
>>
File: syscalls.png (137 KB, 1670x730)
137 KB
137 KB PNG
>>100138863
> those cost literally nothing.
On one hand that's not true, on the other it's completely irrelevant. Another advantage of arenas is that you know which pages have been allocated in what way, which is absolutely not the case with malloc. If you need additional memory and use malloc there's a chance that the function doesn't trigger a syscall because it can serve the request with memory that's already mapped in, or it can trigger a syscall - but there *will* be unnecessary costs associated with that malloc call. With arenas the check if there's still some memory at the end (if you use a stack structure, for instance) is stupidly simple and done in a couple cycles, making the best-case scenario even cheaper and the worst-case scenario not more expensive.

>>100138842
>if you ignore the biggest difference (and the best feature) of arena its just malloc lol
The numbers speak a very different language: >>100135014
>>
>>100138842
Oh, also madvise solves the issue of "kernel doesn't have enough information to know which pages are actually useful".
https://man7.org/linux/man-pages/man2/madvise.2.html
>>
>>100138964
whoever wrote that man oage needs to get the fuck out.
>>
>>100137952
>which part exactly?
The over engineered, drag your feet philosophy of OOP. What I would call "academic OOP." The problem with OOP is that there's a fine line between
>worthless classes you have to re-write
>over engineered classes and boilerplate that work well but burn dev time
The middle ground is wonderful, fast, and productive. But I don't feel like Java as a whole exists in that middle ground. Now if we dug into specific classes...there's good shit and bad shit in everything. But when I've worked in Java I have not felt productive, and it's not just familiarity. Too many instances of "holy shit I have to write all this?" vs. other ecosystems where it's "ok...an instance here, an instance there, a little code...it's doing what I want, next step."

>contrast this with webshit frameworks that are born, completely change their APIs a few times, then die because something else got popular, all spanning over mere months
I'll give you that, I would have to rank web shit lower.

>go ahead and name your use case where the performance is 1. "shit", 2. significantly different than other runtimes
1) Before I ever touched Java even once I had a poor opinion of its performance. Every time in my life when I have touched a Java desktop app I have cringed. Slow as fuck. On top of that I've tried implementing common algorithms across different languages to gauge not just performance, but why the performance is what it is. And I'm always at a loss because Java benchmarks say it's fast but my real life experience is the opposite. Now...that doesn't mean it's not fast enough for a certain task (backend web), especially if you throw hardware at it. I mean people are using Python for fuck's sake.

2) Against C, C++, or even C#? Always it seems.

>there are GUI libraries for Java, even with native-looking themes, but your assertion why no one uses them is just silly
Then why doesn't anyone use them?

>>100138067
C is easy to read as long as the dev isn't shit.
>>
>>100126771
>not secure
maybe giving other people access to your machine was always just a bad idea
>>
>>100139087
>C is easy to read as long as the dev isnt shit
You mean the guy reading it, yes? Because Torvalds' C is fucking unreadable and he is considered a pretty proficient programmer.

>why doesnt anyone use the GUI libraries in java
in my 7th world country they use java for everything. Everything.
>>
>>100136860
If you're citing Lisp programmers as a bastion of sanity I have to assume you attend a clown school that routinely catches fire
>>
>>100139608
>Because Torvalds' C is fucking unreadable
???

How can one think this, his code is actually pretty nice. You sure you're not mixing him up with the obfuscated GNU crap?
>>
guys got any references to a compiled functional language with static typing which isn't Haskell or Gleam?
>>
>>100140325
ocaml, sml, ats2
>>
>>100140342
Thank you
>>
have you read your sicp today?
>>
File: 1707350694604797.jpg (388 KB, 1500x1061)
388 KB
388 KB JPG
>>100140495
nope, although I read some haram manga
>>
>>100140530
protip: good programmers read more manga/comics/fictional books than they do programming books
>>
Cniles can cope and seethe and mald all they want. I use rust btw. Oh, they can't even cope because *segfaults*. Brb writing yet another game engine in rust to take the number of engines written in rust to 51.
>>
@100140646
>desperation: the post

>>100140613
That's not difficult, considering most programming books (that I read, at least) were garbage.
>>
>>100138720
probably because mmap page faults induce expensive context switches.
>>100138842
i have a soft spot for contrarians. imo it's good that arena people are facing some resistance from people who actually know how to program for a change.
he makes some valid points, people really should take a step back any time they try to fit a square peg into a round hole.
not a fan of his argument style tho.
>>
>>100141334
>probably because mmap page faults induce expensive context switches.
MAP_POPULATE disagrees with you.

>people who actually know how to program for a change
Yeah, that's why you didn't know about MAP_POPULATE, you fucking retard.
>>
>>100139087
>On top of that I've tried implementing common algorithms across different languages to gauge not just performance, but why the performance is what it is. And I'm always at a loss because Java benchmarks say it's fast but my real life experience is the opposite.
Java is not a pure number-crunching language, and programming is more than just number crunching. And that's the only thing that algorithm benchmarks test.
In more practical benchmarks, Java frameworks tend to beat other languages' frameworks when it comes to things like request latency or throughput.
In real experience, no one writes applications as huge as enterprise behemoths in low-level languages like C.

>Against C, C++, or even C#? Always it seems.
I meant in practice, for end users. Just measuring numbers of crunching numbers doesn't have any significance on its own.
If something implemented in C takes 0.03s and in Java it takes 1.5s, the practical difference is negligible. It takes longer to just type a command.

>Then why doesn't anyone use them?
Because, again, Java's primary use case are web applications. You have a server application that runs in a shell, if not completely in the background as a service/daemon, and access it through the web browser.

>C is easy to read as long as the dev isn't shit.
Well written Java will always be easier to read than well written C.
It's just the nature of being higher level - with Java, you really only need to focus on the business logic. In C, there will always be technical implementation details, and scopes of items are wider, especially things put in global state. And the larger the codebase, the bigger the difference becomes, to the advantage of Java.
>>
>The over engineered, drag your feet philosophy of OOP. What I would call "academic OOP."
>The middle ground is wonderful, fast, and productive. But I don't feel like Java as a whole exists in that middle ground.
"academic" OOP, or programming and teaching in schools/universities general, is what I usually call when people are first explained a solution with no context (eg. recursion), and are then told to solve a problem using that specific solution when it's not suitable for it (eg. use recursion to solve a typical iterative problem). It's also coupled with the practice of solving problems that were just solved before using a more suited or easier approach, with now a borderline unsuitable approach (eg. just solved the same iterative problem using iteration, now solve it using recursion)
By the time you get to OOP with such an awful teaching technique, there's just no wonder that students universally hate OOP and everything related to it, like design patterns.
Another point is that schools often give no clue how critical IDEs are, and are told students to just install one but use it no more than a glorified text editor. I'm not even going to acknowledge cases where teachers tell students not to use any IDE at all and stick with just a plain text editor (just syntax highlighting won't help much), that is just torture.

>But when I've worked in Java I have not felt productive, and it's not just familiarity. Too many instances of "holy shit I have to write all this?"
My experience is opposite, but only has become so after being actually employed and not doing school/university assignments anymore.
>>
>>100141646
>In more practical benchmarks, Java frameworks tend to beat other languages' frameworks when it comes to things like request latency or throughput.
Provide direct examples, please. All languages' frameworks are dependent on the kernel interfaces, after all, and if Java does anything special, then that's not because it's Java, but because it uses the kernel interfaces in a way that other languages' frameworks (possibly for a good reason?) don't use.

>no one writes applications as huge as enterprise behemoths in low-level languages like C
True, but that's because we've had a literal loss of generational knowledge: https://changelog.com/posts/waterfall-doesnt-mean-what-you-think-it-means
>One of the significant omissions is that they built a prototype with the main purpose of understanding as much of the problem space as they could before they built the system.

Higher languages are good for prototyping, but that's about it. Once you've understood the problem your focus should shift towards scalability.
>>
>>100141643
you are an idiot. please shut the fuck up.
1) mmap was referenced in the context of using it to simplify memory allocation by (ab)using virtual memory and intentionally overcomitting on memory, has nothing to with files. you can't avoid the page faults BECAUSE THE PAGE FAULTS ARE THE WHOLE FUCKING POINT, IT'S MEMORY ALLOCATION ON DEMAND.
2) if you care about fast low-latency io you should be using asynchronous apis that minimze context switches like io_uring and io completion ports. you will never be able to hit io_uring speeds with mmap.
3) using mmap for io is a bad idea if you want to write robust software. https://www.sublimetext.com/blog/articles/use-mmap-with-care
amazing that you have the gall to call people "fucking retard"s when you're so ignorant just because you know think you know some unix minutiae that they dont.
>>
>>100141763
>>100141763
>>100141763
>>
>>100141760
>you can't avoid the page faults BECAUSE THE PAGE FAULTS ARE THE WHOLE FUCKING POINT, IT'S MEMORY ALLOCATION ON DEMAND.
No, YOU shut the fuck up, you raving retard. The argument was:
>page faults induce expensive context switches
But guess what mmap is? That's right, you smoothbrain - it's a fucking kernel call, meaning that the mode switch (yes, that's another thing, you confused mode switches with context switches like the absolute clueless retard chatterbox who deserves the death penalty that you are) has already fucking happened. THE THREAD IS ALREADY EXECUTING IN KERNEL MODE. Triggering pagefaults in kernel mode doesn't trigger context switches, you best argument for retroactive abortions since Microsoft.
>2)
Has nothing to do with memory allocation.
>3)
Don't care, go get a 64-bit CPU to avoid being limited by your virtual address space, and let the kernel I/O manager handle page swaps for you.

It's a miracle no one has murdered you and your entire ilk yet.
>>
>>100141646
>If something implemented in C takes 0.03s and in Java it takes 1.5s, the practical difference is negligible. It takes longer to just type a command.
I could slap you for that. I hate devs with this attitude. 1.5s is an eternity for end users. Even for back end that kind of difference is huge because of the cost.
>>
>>100141646
>Because, again, Java's primary use case are web applications.
That’s not an answer. Sun wanted Java to take over end user apps and pitched it as write once run every where. It never got close. Two reasons among others were shit performance and shit UIs.

>c isn’t used for enterprise
C# is. So is C++ to a lesser degree. Ironically C should be used in some cases because the performance would slash costs.
>>
>>100141997
>1.5s is an eternity for end users.
it's literally not (at least in enterprise shit, anyway)
it's only an "eternity" for autists looking at benchmarks. internal latencies of things you measure in milliseconds is not an end user's concern in the slightest.
>>
>>100140646
>brags about cutting dick off
YWNBAW
>>
>>100142056
>dog shit code is acceptable in enterprise
Only because users can’t kill you.
>>
>>100142042
>Two reasons among others were shit performance and shit UIs.
You seem to keep missing the point that Java is for enterprise applications. It's not for small local-run desktop utilities.
You can still write smaller local programs in Java but that's not the targeted market for it.

>Sun wanted Java to take over end user apps and pitched it as write once run every where.
Can you find a quote where it specifically means "end user apps" as in local-run applications as you're trying to imply?
Because within a web server-client space, Java works perfectly well. You just need a web browser to access the application. On the server side, you can take the exact same JAR or WAR and deploy it on either Linux or Windows with zero changes to it. So "WORA" works in principle.

>Ironically C should be used in some cases because the performance would slash costs.
Ironically, no.
And in practice, also no.
>>
>>100142070
>it's dogshit code because it doesn't tickle MY autism
>>
>>100141334
but he is a shit contrarian he doesnt even seem to know how arenas work and why are the actually good
>>
>>100136012
https://github.com/friendlyanon/simcity-noinstall/blob/master/tools/winmm-exports/main.c
Strings are already slices. Backing buffers are what the slices are pointing into.
>>
>>100136061
name ONE language that guarantees you never make off-by-one errors



[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.