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


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1697419199966691.webm (3.78 MB, 720x720)
3.78 MB
3.78 MB WEBM
What are you working on, /g/? (Russian Edition)

Previous: >>109546620
>>
go back to /int/ romanian tranny poster
>>
Imagine finding such a thing attractive.
>>
>>109581187
why are Romanians like this?
>>
praise Sauron
>>
>>109580998
>What are you working on, /g/? (Russian Edition)
in 2022 I started to implement the craftinginterpreters book in powershell, because I had no other toolchains on my new cagie laptop and I was bored af.
Sometimes I wonder if I should finish it, but I was just looking a bit through the code now and iirc doing the visitor pattern in powershell was kinda fucked up, or I was too dumb for powershell. I am not entirely sure.
But apart from that powershell looks kinda cute.
>>
>>109580998
>slavs aren't white
>t. mystery meat muttmerican (<50% white by the way, officially a brown country now)
>>
>>109580998
Look at this dude.
>>
>>109581634
Having fun with your strawman and salivating over a tranny from muscovy?
>>
>haha i love being racist, it's so funny lol xD
>>
>>109581187
>>109581353
>t. mutt
>>
>>109581675
swing and a miss
>>
>>109580998
Honestly, would bang him if he at least tried to play pretend to not have a fucking man's voice.
>>
>>109580998
вчepa я yзнaл, чтo пpeпpoцeccop C мoжнo иcпoльзoвaть любoгo языкa. вoт HTML:
    <body>
<main>
#define SERVER_LEVEL 1
#include "include/navbar.html"
#undef SERVER_LEVEL
<h3 id="location_indicator">List of boards</h3>
<div id="board_list_container"></div>
>>
File: 1787002847891.png (61 KB, 473x329)
61 KB PNG
>>109580998
I spent my entire day jumping through hoops to get a golang gtk3 application working on Windows XP.
>>
>>109581873
based but cringe
>>
>>109581920
how so
>>
What's the point of making a new compiler when there's already C++ and Rust?
>>
In your opinion, what is wrong with C?
>>
>>109581944
Performance.
>>
>>109581974
>header files
>lack of generic containers
>can't return arrays
>easily obfuscated unreadable code
>leet haxor meme attracts a dumb crowd to the language
>int isn't architecture register size
>>
>muh header files
Grow up.
>muh generic containers
The lack thereof is a good thing for memory control.
>can't return arrays
How would you implement them?
>>
>>109582034
>Grow up.
That is anything but a good argument for header files.
>>
It's the best you deserve.
>>
>>109581974
depends by what you mean by "whats wrong with c"
bc as such: not much. i can hardly think of a way c is inadequate to its usecase
maybe resolving macros recursively could be nice
i vaguely remember that there was a couple times i had to use a void* and i thought that i shouldnt be forced to go through complete pointer anonymization to make the compiler shut up, but i couldnt give you an exact example

im sure there will be a ton of anons who would complain about stuff that actually boils down to using c in a wrong usecase
>>
>>109582043
nta, but
>its like a table of contents for code
its handy af
also organizationally, you can localize various definitions with the header being the private interfaces of the underlying code
>>
>>109582077
>being the private interfaces of the underlying code
ffuck
being the *public interface
>>
>>109582085
Skill issue.
>>
>>109582093
ur moms a skill issue
>>
>>109582104
Yeah, for you.
>>
>>109582112
>>
>>109582034
>How would you implement them?
Well sizeof clearly knows how big they are so the compiler could just return by copy.
>>
>>109582148
That is retarded on so many levels.
>>
>>109582034
>How would you implement them?
with slices. store the length and the pointer in a struct and then have it be used as a slice in the language itself.
Hare does this.
>>
>>109582163
>t. retard
>>
>>109582184
nta but this is bad
just pass your array by reference from the parent scope
y overcomplicate things?
>>
>>109582184
>store the length and the pointer in a struct
How ... would that survive a return? Everything past the stack pointer is volatile at any time.
>>
>>109582206
No, you idiot. Learn Assembly.
>>
Ah, so it wouldn't.
Go join the other autistic retard who's got issues with headers; we're done.
>>
>>109582077
The issue is not the separation but that you copy them over.
And over.
And over.
And over.
>>
>>109580998
His dick is mangled and tiny. Is it what you tranny chasers are into? You disgust me (as a heterosexual man)
>>
Why would you want to return an array?
That's like passing an entire database between host and client. Does it not make more sense to just pass around a reference to that database instead?
>>
>>109582227
You're falling apart at the seams.
>>
>>109582226
Skill issue.

>>109582236
Because they're retarded.
>>
>>109582222
>>
>>109582244
The fuck you mean skill issue #include does what it says.
>>
>>109582236
Copying an array costs like nothing since the data is contiguous and cache local.
>>
>>109582259
Holy retard.

>>109582256
>the compiler does it for him
>still complains about it.
Skill.
Issue.
>>
>>109582271
Wherever you're from they're not sending their best.
>>
>>109582226
youre not wrong.
but on the other hand each compilation unit is its own thing, compiles separately so each one has to have the table of symbols (?)
i dont have an opinion about this, its just a thing
and the copying headers around happens behind the scenes anyways

i guess it simplifies compiler internals on that front
>>
>>109582271
The compiler should not be fucking copypasting the thing every time, retard.
>>
And yet I'm beating you.
How does that make you feel - if you're capable of feelings, autist?
>>
>The compiler should not be fucking copypasting the thing every time
>because
>because
>IT JUST SHOULDN'T OK!!
>>
>>109582279
It's a vestige of not having enough memory in the olden days.
Pascal doesn't do it which is why it compiles fast.
>>
>>109582286
>>109582289
The cschizos are reaching peak insanity.
>>
File: oldman-shrug.jpg (9 KB, 250x203)
9 KB JPG
>>109582296
if its not broke, dont fix it
storage has become faster too, so things even out
and thats in the case youre touching to the headers
bc if you use make, you recompile only what you touched since the last compilation, otherwise
its kindof a non-issue
>>
>"the compiler should be fast"
>doesn't give a shit about slow copies
Apparently schizo > autist.
>>
>>109582335
A lot of language performance comes down to cache locality. Random pointers can miss the cache a lot unlike contiguous memory.
>>
>>109582357
... who gives a *fuck*?! It's STILL a needless copy.
>>
>>109582259
Bet you're the kind of person that loads a texture to a GPU's memory every single frame.
>>
>>109582391
And into the linear memory.
>>
>>109582357
just use an arena that matches your context. its almost always good enough.
you can also use one as array-backing for whatever, so you can go more granular with a simple primitive

you really dont need anything better than arena(s) for 99% of cases

even tho we were talking about a return value, and thats the stack
like when returning a struct.

actually, one should be able to hack c to return an array, by wrapping it in a struct i think
idk why you would want to insist on doing that
because you copy shit around instead of just passing a pointer
but you should be able to do that
>>
I just want C that looks like Rust with generics, data-carrying enums, a package manager and C++'s smart pointers.
>>
>>109582722
Haskell is this without R*st and also without just being C
>>
C is a failed language. Let it die. Just use Rust, Haskell or whatever.
>>
>>109580998
how to get cute male gf like that from programming?
>>
>>109580998
That's a nigga.
>>
>>109582813
This but without Rust or or whatever
>>
>>109582879
Give in to the crab.
>>
I am slowly getting sound working in my gameboy emulator.
Dealing with pitch is annoying.
>>
How do I return an array to the stack in assembly if variables that need to be popped back off are there?
>>
>>109583213
Why would you put the array in the stack?
Just return the pointer to the array in a register.
>>
>>109580998
>no bra
hnnngg
>>
>>109583268
That becomes a dangling pointer if it's not on the heap.
>>
>>109583333
Then prepare an area in the calling subroutines section of the stack where the callee can drop the pointer.
>>
File: 1771953616871514.jpg (51 KB, 896x853)
51 KB JPG
Line 14: Char 29: error: borrow of moved value: `seen` (solution.rs)
>>
>>109583353
No if the array is not on the heap it becomes a dangling pointer. The pointer itself can sit anywhere.
>>
>>109583412
Did you mix up stack and heap before?
>>
>>109583429
No, the array is initialized on the stack. I could change it to be on the heap but that would require raii or garbage collection.
>>
llms are badder at making good codes than me
but they are gooder at making bad codes than me
>>
I don't use Rust but I still want to be a cute anime girl.
>>
Working on flick switch on codewars. Solved in JS and another language, got one more to go. I think I have a project I should be working on too, but I have to check to see what it is. I prefer doing small problems over projects. Projects have not been very interesting to me.
>>
>>109583625
I got tired of small problems after leaving college.
>>
>>109581974
marcos
>>
C sucks because of UB.
>>
I'm gonna copy an array.
>>
>>109583696
NOOOOOOOOOOOOOOOOOOOOOO
>>
>>109583357
You will always be a woman.
>>
>>109582430
>you really dont need anything better than arena(s) for 99% of cases
you need to dynamically grow things you don’t know the final size of more than 1% of the time, especially for certain tasks like compilers or anything involving file processing where you are growing data structures based on the input and in a way where you can’t just keep pushing onto the same arena


you can chunk up arrays but that has non-trivial costs to growth complexity, iteration complexity and speed compared to a contiguous dynamic array, even after considering the cost of copying the entire array on growth
>>
File: 1758126336162048.png (151 KB, 465x453)
151 KB PNG
>>109580998
>no bra
>>
>>109583732
Your mom
>>
Math, my only weakness.
>>
>>109583727
Contiguous dynamic array will always be best due to cache locality.
>>
>>109583775
You have more.
>>
In a Cmake project, how are you intended to include sources & headers when the project begins growing and you need to start organizing things in subdirectories?

you can use add_library and build each sub directory as its own component and then link them all in to the exe at the end which is quite clean, and makes producing multiple binaries in the same project (e.g. utility applications that want a single component) very easy and compilation is sped up as you don't need to recompile each component to rebuild the application. however you lose out on optimizations because each library is now built independently and you need to structure things in such a way that the components are independent of each other which may needlessly raise complexity of them when what they really are is just orginzation of code rather than truly indipendant components

you can also just target_sources & target_include_directories with the application target inside each component which gives you the optimizations and ability to treat all of your source files as 1 big project (no unnecessary interfaces) but you lose all those other benefits of library-ifying them. it's especially bad if you want to throw a quick utility program together because you nee to duplicate all that target sourcing stuff in every single cmake with the files
>>
>>109582023
> header files
Best thing ever.
>lack of generic containers
Your skill issue.
>can't return arrays
Return them inside a struct, you dim wit.
>easily obfuscated unreadable code
Your skill issue, again.
>leet haxor meme attracts a dumb crowd to the language
Your fault, stay away from the language, is not for dumb "people" like you.
>int isn't architecture register size
Use stdint.h, you moron.
>>
>>109583879
>cschizo thinks lack of generic containers is a skill issue
>>
>>109583879
You are very triggered.
>>
I'm still copying an array by value and there's nothing any of you can do about it.
>>
>>109583785
guess what you can't do with an arena
>>
>>109582023
>int isn't architecture register size
architecture register size isn't necessarily the fastest thing

math operations on 32bit registers are faster than 64bit, especially divides

I agree about headers and generics though. at least you can hack together generics with macros and still keep type safety if you generate the interfaces
>>
How do I keep my stupid compiler simple? Even classic C's compiler was 10000-12000 loc. I want something that fits in 1000 lines that can implement vectors.
>>
>there's nothing any of you can do about it
We can shame you into suicide and then make fun of the way you went out.

>>109583951
>math operations on 32bit registers are faster than 64bit
They're smaller too, on x64 at least. 64-bit registers require an REX prefix.

>>109583988
The classic C compiler produced unoptimized garbage.
>>
>>109584068
And GCC is 15 million loc.
>>
>>109584068
>We can shame you into suicide and then make fun of the way you went out.
Apologize to Terry now!
>>
>>109583805
:(
>>
>>109580998
please tell me that's a woman, and not a tranny
>>
File: memcpy2.png (46 KB, 1630x720)
46 KB PNG
>>109583785
It.
Doesn't.
Matter.
With a "normal", "caller provides a pointer for me" design you can have an array be almost entirely cached by L1, with your copies it can only be half of L1 before you drop to L2 - which ignores that
- even L1 has latencies.
- there's other shit in there you might not want to disturb.

Then there's the fact that letting the compiler issue copies is a baaaaaad idea, because fast copies depend on architectural shit you don't even understand, like how loading data via SIMD always pollutes the cache (NT hint is ignored), but storing it doesn't (NT hint is honored), or how you sometimes deal with shit hardware running even shittier kernels that are limited to purely scalar copy operations, where the pipeline cannot clearly switch between the two; we used to have a Celeron guy with that exact same problem.
>just use memcpy
Yeah, as I said, baaaaaad idea. Copies should *always be explicit*.

Like, where is this idea coming from that copies are oh-so-fast?
>>
>>109584144
Sepples farts out copies like the wind and is fast.
>>
>>109584121
>the guy who wanted us to go back to DOS-era levels of nonsense
>when he could've actually pioneered a way to have the best of both worlds by providing a new kernel API that didn't fall into the same nonsense traps as UNIX, NT, Linux, Darwin, or BSD
Nah. I'm glad he took out the trash.

>>109584103
And GCC has support for global register variables I have yet to see clang catch up to.
>that being said ...

>>109584134
Search your feelings.
You know it to be true.
>>
>>109584144
so you're saying I should just eat the indirect jump cost and cache locality cost of an array broken up into subarrays instead of using a conventional dynamic array?
>>
>>109584154
Dude.

Stop.

Just stop.
>>
File: 1759995144926043.gif (2.26 MB, 211x374)
2.26 MB GIF
why the fuck do I need to learn bit manipulation?
like what are even the practical uses
>right shift divides by 2, left shift divides by two
>xor is abs on subtraction
uhh...????????
>>
>>109584175
>left shift multiplies by two*
>>
>>109584169
No, I'm saying that the fastest code is the code that doesn't run. And if locality is such a big matter to you, then you *still* want to avoid potential copies that are introduced by reallocs/resizes by using the reserve-high/commit-low pattern. If there's one thing we have enough of these days it's virtual address space.

And guess what, RH/CL is actively trying to avoid copies.
>>
>>109584175
>like what are even the practical uses
de/serializing a byte stream
using registers
party tricks
>>
>>109584134
It's ugly dude, makeup and plastic surgery. He has plastic everywhere.
>>
>>109584175
>LEA allows me to multiply by ten in two cycles?!
>what sorcery is this?!
>>
Copies are fine. The problem is keeping them on the stack instead of the heap.
>>
>>109584144
>>
>>109584188
that answers nothing. if you need the behavior of a dynamic array but copy on grow is not ideal then what are you supposed to use?
>>
>>109584175
Doing things faster and more efficiently.
>>
>>109584213
Dude just complains because he's not creative enough to come up with solutions.
>>
>>109584213
>if you need the behavior of a dynamic array but copy on grow is not ideal then what are you supposed to use?
Dude.

Duuuuude.

Read your own sentence again.

>if you need
>need
>absolutely need
>for whatever reason
>even if it's not ideal
>but you [need] it

The question isn't what to do, the question is if you actually [need] it.
>>
I still want to return a vla on the stack without disturbing the natural order of assembly.
>>
>>109584190
>de/serializing a byte stream
why would I need to do this? all the shit that requires streaming has frameworks already built for me. why would I ever need to interact with binary level information?

>>109584217
except compilers already do everything for you under the hood. you're only making your code unreadable to junior devs and people that haven't studied bit manipulation.
why would you write x & 1 == 1 instead of x % 2 == 1? everyone understands the second, some people don't understand the first.
>>
>>109584231
Good luck.
>>
>>109584227
I need something that grows. It does not necessarily need to be contiguous but there is a complexity cost and overhead cost to that where a dynamic array is simple.

What am I supposed to use because dynamic arrays are suddenly such a bad thing? I came up with a solution but you ignored it. What is the solution?
>>
>>109584246
>where a dynamic array is simple
Simple for whom? Simple for you, or simple for the hardware?
>>
>>109584232
>except compilers already do everything for you under the hood
they don't, faggot
>>
Soon everyone's going to make like cschizos and just store everything in linked lists on the heap.
>>
>>109583696

ivan how are you going to if you cannot remember a line
>>
>>109584248
literally both

I'm still waiting for an answer btw
>>
Godbolt says C++ throws everything on the heap even if it looks like it should be on the stack.
>>
>>109584232
>except compilers already do everything for you under the hood.
They don't do everything for you. They will recognize and optimize many of the simplest cases, but you can't trust that the compiler will optimize everything out for you.
>you're only making your code unreadable to junior devs and people that haven't studied bit manipulation.
That's their problem. They should have been taught it if they took courses, or studied it if learning themselves, otherwise they're just unqualified.
>>
>>109584259
>literally both
And that's why I call so many losers here "autists".
Because they simply cannot cram it into their autistic fucking skulls that whatever THEY perceive to be simple is NOT what the hardware perceives to be simple. It's like, there's such a massive disconnect in theory of mind it's fucking unbelievable.
>>
>>109584268
Junior devs write the best C I've ever seen.
>>
>>109584279
>length
>rest of array
It's that simple.
>>
>>109584280
They must be good at bit manipulation, then.
>>
>just eat the copy dude
You do you then. I've said all I needed to say.
>>
>>109584288
It's either that for stack allocated arrays or they die when they go out of scope.
>>
>>109584299
>for stack allocated arrays
>>109584227
>>
>>109584279
I'm thinking about every layer of the problem down to the hardware, including the overhead of a heap allocator and everything in between. A dynamic array is just a trivial amount of work. it just is, both for the programmer and the hardware.

If you make something like a chunked array with an offset table for each subarray, sure you can leverage a simpler structure like a bump allocator or an arena underneath, but you are paying for an additional cost upfront. suddenly you have double indirection and need to compute log2 (if you are doubling each subarray) for every index access and add a bunch of additional complexity to your for loops when you just want to iterate it. sure, you could use clz intrinsics or whatever but the overhead is adding up fast compared to the unmatched speed of contiguous array indexing.

you are still fervently dodging the question btw
>>
>>109584328
>A dynamic array is just a trivial amount of work
>>109584144
>>
>>109584268
>That's their problem. They should have been taught it if they took courses,
clearly you've never had a real job because this mentality just makes everyone hate you and causes unnecessary problems for everybody
>hey man can you just use the modulo operator
>"WTF? THEY DIDN'T TEACH YOU BIT MANIPULATION IN UNDERGRAD?"
>no dude im self taught and actually focused on building shit instead of making my programs .0001% faster
>>
>>109584336
are you just going to ignore literally everything I just said and keep dodging? still waiting for an answer like 6 posts later when you don't have dick to say
>>
>>109584336
Like, it's fucking unbelievable how autism makes people LITERALLY incapable of recognizing just how much they're living in an illusion.
>I want things to be fast
>but MY way
>what do you mean, MY way isn't fast
>that cannot be

I'm done arguing with your ilk.
>>
>>109584344
Yes, autist. I'll continue to live in reality, and you can continue to live in your own head.
>>
>>109584347
>[x] is BAD
>okay, what is better then? here are my requirements and here is one possible alternative I have considered...
>*crickets*
you have no argument. you are saying literally nothing at all
>>
>>109584343
Stop making excuses for not learning.
>>
>>109584343
why are we talking about this like bitwise operations are difficult or confusing

how is this filtering you to the point you're making posts like this in the first place
>>
>>109584347
>I'm done arguing with your ilk.
wish this was true
>>
>>109584361
... hey.

Hey, autist.

How much more obvious do I have to make this?

Like, are you actually retarded? Do we need to euthanize you? Should we only vote in people who promise to pull a Third Reich and get rid of defects like you?
>>109584227

Fuck it, at this point I'll only vote in people who promise to actively genocide autists.
>>
>wish this was true
Oh, I'll still shame you into literal suicide like 764.
Bunch of fucking heroes. They take out the trash like no one's business.
>>
>>109584413
hey, retard. I already told you contiguity is not a strict requirement which opens up plenty of options. I asked for something better and you refused to answer
>>
>>109584347
>>
>>109584444
>>
Hard mode: Create a C++ compiler without committing suicide.
>>
>>109584413
>reddit spacing
>>
I think I removed more code than I wrote, today.
>>
>muh reddit
>reddit
>reddit
>reddit
>REDDIT
>REDDIT!!!
>REDDIT!!!!!!!!!!!

I swear to God, autists suck so hard at pattern matching.
Like, why haven't you killed yourself already, making it easier for everyone around you? The world would be a much better place without you.

Not that you ever considered that, because you're hallow. Completely empty. Not a human being. No empathy, no nothing, just spite.
>>
a hit dog will holler
>>
>I swear to God, autists suck so hard at pattern matching.
>>
I have yet to even implement returning structs by value.
>>
Does Forth have dynamic lists or the ability to create them?
>>
>>109582236
>Why would you want to return an array?
Most calling conventions just pass a hidden pointer and the caller is responsible for stack-allocating the appropriate amount of memory. No copying occurs.
>>
https://leetcode.com/problems/range-sum-query-2d-mutable/
bout to have some fun spending 2 hours working on a 2d segment tree
>>
>>109584716
>Most calling conventions
Use RAX.
Yes, that's only 64 bits.
>>
>>109584778
No, what I meant is that most calling conventions, WHEN you call a function that returns a large container type, actually just pass a pointer to a stack-allocated space inside the caller's frame which the callee writes into. Nothing gets returned in RAX.
>>
>>109584175
because you do stuff like
mask := 0b0001
// setting a bit
target|= mask
// erasing a bit
target &= ~mask
// inverting a bit
target ^= mask

you find this everywhere from embedded, simd or in games for 2d maps. Its very easy to grasp if you just use it.
>>
>>109584869
the other day I needed to add up a bunch of power of 2 values from a base size I knew was also power of 2, aligned to some power of 2 minimum and it looked something like

total_size = (size | (size - 1)) & ~(min_size - 1);


If I didn't know how to fiddle with bits it would have been some much slower, drawn out thing, possibly with a loop even, which would mean O(logn) instead of O(1). Plus this is literally like 3 or 4 operations on a cpu. Very fast. It's like knowing math. If you know it you will be able to reduce complexity in places where other people would have just used some generic equation that had a much higher cost, but because you could make certain assumptions you could cut away a ton of fat.
>>
>>109583816
Well, sometimes there are no perfect solutions, only tradeoffs. Personally I have `add_library` in the root and include a subdirectory containing `target_sources`.
>>
>>109584790
>just pass a pointer to a stack-allocated space inside the caller's frame which the callee writes into. Nothing gets returned in RAX.
Yeah, well, I'm afraid compilers are not good enough for that scheme in 2026.

I mean, let's be honest, they cannot even deviate from their fucking calling convention.

And yet, we hear NOTHING about compiler devs having their houses burnt down.
>>
That's two audio channels down on my emulator. Not perfect, but working.
Now I have to pick whether to do wave or noise next. I think noise will be easier...
>>
>>109580998
i will admit that for a tranny he's got nice tits
hearing the voice instantly turns you off thoughbeit
>>
File: 39672 - SoyBooru.jpg (93 KB, 1080x1042)
93 KB JPG
haha i love being racist, it's so funny lol xD
>>
programming in rust is like trying to walk without legs
so fucking painful
>every other language: for i in 0...1 { print(i) }
>0, 1
>rust: for i in 0..1 { println!("{}", i); } (have to do this stupid shit too)
>0
>>
>>109585273
>>every other language: for i in 0...1 { print(i) }
shitty languages are inclusive on the end of range.
>>
File: 1783880425556982.jpg (27 KB, 640x605)
27 KB JPG
The International Committee of Programming Languages has just made an announcement.

From now on, there will be only four programming languages allowed for the rest of humanity:

- C
- C++
- Rust
- Assembly

If you are currently using any other programming language, stop immediately and rewrite everything in one of the languages listed above.
>>
>>109585512
why would anyone ever use rust
>>
>>109585512
Replace Rust with Python and we good.
>>
>>109585512
good, I'm going to rewrite our corporate management slop backend to C++, see you in next millennium
>>
>>109580998
>Russian Edition
she's so lovely god I love women
>>
File: 1778096349948548.png (864 KB, 918x784)
864 KB PNG
Have you programmed an auto uploader for pic related?
>>
>>109585512
Replace Rust with Javascript and we good
>>
File: Nzmj7K0FNRY-HD.jpg (118 KB, 1280x720)
118 KB JPG
>>109585672
https://www.youtube.com/watch?v=Nzmj7K0FNRY
>>
>>109585273
you can just do dbg!(i) instead of println("{}", i)
also no most other languages will not do 0..1 as 0, 1 they will have 0.
>>
File: file.png (90 KB, 1050x601)
90 KB PNG
>>109585955
>>
>>109580998
That's someone's son
>>
>>109580998
Is it one of these girlfriend eye contact training videos?
>>
>>109585984
I would be proud if this was my son
>>
Why does GCC do this?
float inv(float f) {
return 1/f;
}

Compile with -O3
inv:
movaps xmm1, xmm0
movss xmm0, DWORD PTR .LC0[rip]
divss xmm0, xmm1
ret
.LC0:
.long 1065353216


Why the fuck isn't it using the RCPSS instruction? by the way this also happens with clang
>>
>>109585627
Seems there are only LARPers here.
>>
>>109586572
>boo-hoo nobody cares about my vibecoded slop
>>109586623
no, i dont
post something hpc related im in desire of coffee
>>
>>109586682
go back, LLM slop redditor
>>
>>109586700
>doesnt recognize the capitalization
im home faggot + post code
bc and not a single line has been written using a slopbot
>>
>>109586713
redditor trying to not be cancerous challenge failed
>>
>>109586738
that was the most reddit-esque sounding thing ive heard in a good while
>>
>>109580998
she cute
>>
>>109586754
how many tokens to generate that?
>>
heres more opencl spaghetti to assert my dominance
all of this inbred shit neatly tucked away behind 12-ish function calls
im more satisfied from this than from the project this supports
>>
>>109586825
0
im not a vibeshitter

i did heavily abuse chat gpts free tier to help me properly figure out opencl's interfacing though
it was quite the upgrade, ngl
before that i was just intializing a random gpu with code i cobbled together from fragmentary documentation, half a youtube tutorial and a moldy baguette
https://www.youtube.com/watch?v=RKyhHonQMbw
>>
>>109586865
and yet you admitted being in the LLM slop thread and press enter once because you're a retard from reddit kek
>>
>>109586925
>oh, noes, you browse 4chan while being on 4 chan!
yeah, im not sure where you were going with that
>>
like clockwork, the redditor is schizophrenic hence it goes full circle immediately
>>
>>109586965
lol.
>no you
that means you care about em
how childish
>>
>>109582023
also bad build system, lack of namespaces, horrid string handling, overuse of macros to achieve anything
>>109582034
also c users being mentally ill like this guy does not help your case at all
>>109582077
other langs have way better tools for organizing and documenting code, it is cool C could do that one billion years ago but today thats not really a good arguement for header files
>>
>>109586780
>>109585615
>she
>>
>>109586523
https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-mrecip-2
>>
>>109585512
wrong, here is the real list
- javascript
- typescript
- python
- wasm
>>
>>109587008
the argument is to simplify your toolchain to reduce cognitive load
thats also why my function-names match the source file's, and which represents their position in the filesystem, relative to the root of the lib

with the comments and extra explicit variable, function names, and intuitive interfacings i manage to reduce the background cognitive load to almost 0
>>
>>109581819
He got surgery or something now and sounds like a woman now
>>
>>109587008
>>109587053 cont.
this makes you quasi independent from the toolchain, too
no matter the ide, or even text editor, ill keep the same functionality, even if i have to ls around
bc the meta-functionality of the code is inscribed in the code itself and in the file layout
never had a use for that, but it is a thing with this method of doing things
>>
>>109587078
estrogen tits are a dead giveaway
>>
>>109587024
oh so this isn't as accurate... i guess i should read compiler options more
>>
ChatGPT writes my formulas for me, but I write the code to implement it into my program.
>>
>>109586523
1065353216L is equivalent to (float) 1.0
divss then divides it by f
reciprocal of f is returned as intended
>>
>>109583638
Different strokes for different folks, I guess. I still like them.
>>
>>109585512
>no functional languages
replace C++ with haskell
>vague "assembly"
at least say which assembly, im for RISC-V
>>
>>109587053
>>109586999
>>109586942
>>109586865
>>109586840
>>109586754
>>109586682

>error handling uses __LINE__, which is brittle because changing the file can change error values.
>wrapper is becoming pretty complex for something meant to simplify OpenCL.
>exposes a lot of raw OpenCL internals instead of fully hiding them.
>Some parts look unfinished, especially kernel argument/buffer mapping.
>>
>>109580998
>What are you working on
WAYWO
>>
>>109580998
in my c code i like to have little string utilities, like a variable number of arguments function that concatenates strings together and to avoid allocations i save it in a static char array and return it. however, it is a problem is that the memory holds what i want only before the next invocation, and i am wondering if there are some sort of source code annotations that allows the compiler or static analyzer to check this and give a warning or an error. it can assume that whatever concat returns is valid only until the next invocation.
>>
>>109582023
>leet haxor meme attracts a dumb crowd to the language
retards get filtered sooner or later
>>
>>109587349
line was ad-hoc bc i cant be arsed to type 64 individual values, mang
i just copy pasted the defines from cl.h, done some trimming and dealt with the thing with multiline editing
also i felt like a king-size switch statement is equal parts divine inspiration and cognitohazard-levels of niggerlisciousness
so it's staying in

>wrapper becoming pretty complex
iunno, its the level of abstraction i think im gonna want.
a thin layer, just abstracting all the spaghetti involved in device discovery or logging
it still has to get battle tested so to speak, im dogfooding that

>exposes a lot of raw OpenCL internals instead of fully hiding them.
hidding them would just mean doing defines and appending FN_SYS_OPENCL to them. i decided against.

>buffer mapping, kernel args
yes. its still a wip, but that the easiest part
it just would be passing flags, so adding another parameter to the function definitions. no biggie
i left that for later bc i decided i spent enough time on this side quest
i could do it now, but im really unmotivated and i would have to review the docs on whats associated with the flags, give it a proper think whether i include them verbatim, or with some level of abstraction
also theres a couple things to still implement like defaulting to sane defaults with workgroup size
onther thing id have to do a deeper dive in, see how to build a sane defaults automation, and if one is even needed

and for the complexity, once ill decide to release it, then ill write higher levels of abstraction
i think this thing could easily be turned into a nifty lil lib where you can access the subjascent internals at the level you need (opencl/lib/self-driving-level)
>>
>>109587456
>relies on the caller passing a final `NULL`.
>If NULL is omitted, va_arg() reads past the arguments
>undefined behavior
>also, static buffer means results are overwritten by later calls and it isn’t thread-safe.
>>
>>109587456
just accept a destination buffer that you write in?
>>
>>109587008
>overuse of macros to achieve anything
but i like macros :(
>>
>>109587496
the idea is that i don't want to do that, so instead of that i make some ownership constraints that can't be described by c, so i am wondering if some static analyzers can do that provided i describe this ownership relationship. i manage memory in such a way that i often get similar constraints that can definitely be checked by a static analyzer
>>
>>109580998
Do girls know how ugly it is when they put their hair behind their shoulders? It's an instant -40% to their overall appeal, yet you see them do it all the time. Even when highlighting their attractiveness is the goal of the situation.
>>
>>109587344
functional is haram.
All assembly is equal, but RISC-V is more equal than others
>>
>Beavers are testing their construction every moment as they go. In that way they really aren't exactly true engineers. They have no need to predict how something will behave, they just build and fix and fix and build until it works. And there's something admirable in that.
-Grady Hillhouse, Practical Engineering
>>
>>109587628
when building libs, be a beaver, dont try to be an engineer
or you'll end up with a tangle of unmaintainable, complex spaghetti
-(me)
>>
>>109587628
>>109587644 cont.
although, admittedly, i still used pen and paper when designing my interfaces
the primitives of the lib, specifically

so, being a beaver could be reformulated into iterative engineering, no?
>>
>>109587492
>reads what the code does
yes i wrote the function do that and it has clear and checkable at compile time constraints, i just can't find how to check them
>>
>>109587172
I know, but I thought rcpss was better because it would be 1 instruction instead of 3
>>
>>109587572
Anon, that's a Russian man.
>>
>>109587644
Typically being a beaver is how you end up with complex spaghetti, no?

>>109587674
Yeah, I just thought it was funny how his description of beavers not being "true engineers" so spot on describes software engineering.
>>
>Beavers show almost no consideration of margins. They use cheap continuous labour as their factor of safety.
>>
Please stop talking about beavers, this is a blue board
>>
>>109588023
>Typically being a beaver is how you end up with complex spaghetti, no?
in my experience its the exact opposite
when i set out to build a lib like an engineer
i always overengineer it because i prorgam for every case imaginable

but thats not what i need. thats recreating c++, but in c.
so now i took the opposite approach, i co-evolve my lib with the code im wrting, and i zero in on whats actually practical as opposite to whats possible
>>
>>109588180
Programming is beaver work.
>>
>>109588180
>>109588255
and beavers *are a (landscaping) technology
(4keks thinks the link is spam, sry)
>>
>>109584232
>you're only making your code unreadable to junior devs and people that haven't studied bit manipulation
just say you aren't white
>>
Shouldn't every software developer understand bit twiddling?
>>
>>109580998
I look like that
>>
I'm trying to make a project with python + pandas + jupyter notebook
>>
With excel and etc
>>
>>109589122
i would return them to the zoo
>>
>>109588023
>Typically being a beaver is how you end up with complex spaghetti, no?

Nta, but it's often laziness that causes spaghetti code. Being a beaver will test if your code will cause problems even if it's spaghetti code. Those two aren't mutually exclusive, but if you're a beaver you tend not to write spaghetti code and vice versa.
>>
what's with all the animals in this thread?
>>
>>109587572
I had long hair and I can relate to girls doing this, it's annoying as fuck when hair gets everywhere around your ears, eyes and face, pulling it back makes it more manageable.
>>
>>109589178
Wha?
>>
>>109584343
People that don't bother learn something as simple as bit manipulation will suck at their job. Even javascript has bit manipulation.
>>
Finishing help the bookseller in java tomorrow. I started it today. Spent a lot of time looking up how to call stuff but other than that not bad at all. Need to finish some string stuff, think I can drop the need for the second list as well. Probably going to try it in ocaml at some point.
>>
>>109587572
True. I'm gay as well and I really hate when w*men do that.
>>
huge pages with my concurrent jobs system was a massive gain and now im significantly beating no-consumer-tokens configurations of moodycamel in raw throughput
>>
>>109584279
>muh hardware
>>
>>109583576
good man
>>
My language is now pass vlas by reference and return vlas by reference or value.
>>
My programming language is now memory safe because I added OOB checks.
>>
>>109587492
What would you suggest to do different? You don't have many options for variadic functions in C
>>
File: 1758700047272457.png (140 KB, 529x538)
140 KB PNG
>CHUD YOU DON'T GET IT YOU CAN'T INDEX AN ARRAY WITH AN INTEGER, YOU NEED TO CONVERT IT TO USIZE BECAUSE A SIGNED INT COULD BE NEGATIVE WHICH WILL CAUSE A RUNTIME CRASH
>OKAY BUT IT DOESN'T MATTER THAT INDEXING OUT OF BOUNDS WILL CRASH ANYWAYS, YOU NEED TO TYPE "as usize" EVERY SINGLE FUCKING INDEX TO PREVENT ONE SPECIFIC CRASH
>NO THE COMPILER CAN'T JUST INFER THIS FOR YOU, WE TROONSTACEANS DON'T DO IMPLICIT TYPE CONVERSIONS
>YOU WILL TYPE self. AND as usize EVERY OTHER LINE
>>
>>109590825
In my language I made you can index with integers.
>>
>>109590825
guys like you get mad at go's if err != nil, too, correct?
Maybe go back to javascript and write some apps. You'll be fine
>>
>>109580998
i want to cum in her face
>>
>>109590856
Why are normies so obsessed with cuming in face and blowjobs?
both things are boring af. Just lick feet bro
>>
Why does JavaScript get so little discussion in these threads?
>>
File: 1755812004810309.png (224 KB, 800x789)
224 KB PNG
>WHAT'S THAT CHUD? YOU WANT A min() FUNCTION? NOOOOO SORRY YOU HAVE TO IMPORT IT FROM THE STANDARD LIBRARY
>ALSO YOU CAN'T JUST IMPORT IT AND THEN USE IT, YOU HAVE TO SPECIFY THAT YOU'RE USING IT FROM THE IMPORT EVERY SINGLE TIME
>I HOPE YOU ENJOY TYPING std::cmp::min() OVER AND OVER, THE COMPILER CAN'T INFER THIS FOR YOU. NO YOU CAN'T JUST IMPORT THE ENTIRE MODULE AND HAVE THE STRIPPER FIGURE IT OUT ITSELF. THIS IS THE FUTURE, CHUDDIE
>>
>>109590957
It's not like writing your own min function is hard.
>>
>>109590957
Wrap it in a function lmao.
>>
>>109587456
why would you not just use a scratch arena for this
>>
>>109588023
>Typically being a beaver is how you end up with complex spaghetti, no?

no, you don’t fully understand a problem until you’ve actually done it. so you have to play it by ear and build the naive implementation and then go through a refinement process later.
>>
>>109590922
because this thread is mostly recreational and javascript is primarily a corposlop/brown/cog-in-the-machine language
>>
>>109591259
>solve this, chud
>here
>deployed on prod
>ok time to refine
>refine? it works and it's battletested, no, we cannot touch it
>>
>>109590922
We're all still salty we could have had Scheme in the browser.
>>
>>109590922
Most people here are NEETs.
>>
>>109590922
what's there to discuss? The people that use it have invested hundreds of millions into abstracting it away.
>>
>>109590922
>Why does JavaScript get so little discussion in these threads?
There's a separate webshitter general
>>
>>109591168
>OMG YOU USED TWO STACK FRAMES?!
or something like that
>>
coroutines in C

coroutine void Counter_Test(void* Arg) {
uint32* ValueRef = (Arg);

for (uint32 i = 0; i != 100; ++i) {
*ValueRef = i;
Coroutine_Yield();
}

return;
}


entrypoint int main(void) {
uint32 Value;
coroutine Co;
Coroutine_Create(&Co, Counter_Test, &Value);

while (Coroutine_Resume(&Co)) {
Print("%u\n", Value);
}

return (0);
}



I like the return value of resume being a boolean for when the function stops yielding and finally returns but part of me wants to make resume and yield both take and return void*s and make the return value of resume be the argument passed to yield and vise versa but I think just using a boolean as shown is more ergonomic. When the coroutine finally returns, it will also automatically deallocates its own stack and finally return false. I'll still have a Coroutine_Destroy() function anyway though for cases where you're finished with the coroutine before it actually reaches its return.
>>
File: 1762776321261818.gif (390 KB, 220x205)
390 KB GIF
fn sum_region(&self, row1: i32, col1: i32, row2: i32, col2: i32) -> i32 {
let row1 = row1 as usize; let col1 = col1 as usize; let row2 = row2 as usize; let col2 = col2 as usize;
return self.dp[row2 + 1][col2 + 1] - self.dp[row1][col2 + 1] - self.dp[row2 + 1][col1] + (self.dp[row1][col1]);
}
>>
>>109592157
don't be afraid of vertical space anon, you have a lot of pixels!
>>
The compiler is less than 1000 lines and I was able to implement a vector in my young programming language.
glo vecnew = (\e n = 
mem[e n + 1]
{
cap = n + 1
len = n
mem = mem
}
)
glo vecget = (\v n = (mem v)->n)
glo vecset = (\v n e = !(mem v)->n e)
glo _vecexpand = (\v newmem i =
| i >= len v = !mem v newmem
| _ = !newmem->i @vecget v i
)
glo vecexpand = (\v =
!cap v ((cap v) * 2)
arr[(@vecget v 0) (cap v)]
@_vecexpand v arr 0
)
glo vecpush = (\v e =
!(mem v)->(len v) e
!len v ((len v) + 1)
| (len v) >= (cap v) = @vecexpand v _
)

v = @vecnew 0 0

@vecpush v 3

putc 48 + @vecget v 0
>>
>>109588225
it's very possible plan ahead without overengineering
you just need to stick to the plan when implementing (ie. no veering off to implement any unplanned "improvements"), and the plan itself needs to be built according to some specific goals and requirements rather than a goalless brainstorm of ideas
>>
File: 1764319034372947.png (363 KB, 540x569)
363 KB PNG
>Line 3: Char 22: error: cannot borrow `reserved_seats` as mutable, as it is not declared as mutable (solution.rs)
>Line 3: Char 37: error: no method named `sorted` found for struct `Vec<Vec<i32>>` in the current scope (solution.rs)
>Line 3: Char 37: error: type mismatch in closure arguments (solution.rs)
>Line 3: Char 74: error: mismatched types (solution.rs) expected `Ordering`, found `bool`
>>
>>109590957
I look like that
>>
>>109592181
I look like that.
>>
C, Rust and JS are ugly
>>
>>109592023
What is a coroutine?
>>
>>109590665
>you don't need magic, just pass the count first
foo(3, a, b, c)
>boring as fuck but now you can't walk off the end of va_arg because anon forgot the NULL

>about static buffer issue:
>make the caller provide the output buffer instead of returning a static one
>congrats, now it's reentrant too
>>
>>109592412
It's possible, but you'll be very unproductive if every change requires you going back to the drawing board. Even NASA doesn't do that.
>>
>>109592517
Just code in Assembly. Then everything's a cheap hack.
>>
>>109592181
good job anon
>>
isPrime :: Integer -> Bool
isPrime n
| n < 2 = False
| otherwise = all (\d -> n `mod` d /= 0) [2 .. floor (sqrt (fromIntegral n))]

main :: IO ()
main = do
print (isPrime 2) -- True
print (isPrime 17) -- True
print (isPrime 25) -- False
>>
>>109592533
Yeah, just plan ahead for everything, even the heat death of the universe.
>>
>>109580998
There's no way that's not a girl. Look at those huge nipples.
>>
>>109592587
In Assembly you can just hack it together as you go.
>>
>>109592636
You sound like a nocoder.
>>
>>109592666
Nice try, Satan. I'm just enlightened by my recent experiences with Assembly.
>>
Write a program that draws a rectangle in ascii art.
>>
File: file.png (66 KB, 1006x921)
66 KB PNG
>>109592727
>Write a program that draws a rectangle in ascii

slopped
>>
>>109592738
Make it do it in Assembly.
>>
>>109592738
>width is double height
>output is basically square
It's over for AI.
>>
File: file.png (113 KB, 986x1412)
113 KB PNG
>>109592746
>>
>>109592768
The robots know their own processor language. It's over now.
>>
File: IMG_9602.jpg (29 KB, 472x475)
29 KB JPG
The ai overpenis is too scary.
>>
Lisp is for fun.
>>
>>109592768
I'm pretty sure that doesn't even work.
>>
trying to understand the bit manipulation solution to today's leetcode problem is making me feel like a retard
>>
>>109592503
It's a function with it's own unique stack separate from the caller, but it executes sequentially, it's not a separate thread or anything and it's very lightweight

a classic example of where this is useful is imagine you need to iterate a complex object all over the place. if you wanted to make an iterator for it, suddenly the iteration code you originally wrote for the simple case needs to be transformed to keep track of the state in some struct between calls to the iterator. this is fucking annoying. a coroutine lets you take the original code and slap a yield() in the middle of the iteration loop, at which point it passes control back to the caller, but instead of following conventional rules and shrinking the stack after returning, it keeps all of its original state in its own stack, so you can just resume where you left off at any point. you no longer need to externally track state in a struct and rewrite it, the code looks like it would in the simple case
>>
>>109592856
Thank you for the explanation.
>>
File: 1782289692083911.png (71 KB, 240x240)
71 KB PNG
Rust does not support dictionary subscripting with bracket syntax like my_map["key"]. Instead, Rust uses explicit methods like .get("key") or .insert("key", value) on a std::collections::HashMap.
>>
File: debug.png (56 KB, 1858x740)
56 KB PNG
Why cant debuggers do this automatically? Future debugger should have built in LLM to fix shit
>>
>>109593053
So? [] is reserved for lists.
>>
>>109593172
there was nothing wrong with line 131
>>
>>109593211
women detected, all men code like this
>>
>>109593226
you must accidentally hit on a lot of men
>>
>>109593053
Assembly doesn't allow that either. Think about it!!!
>>
>>109592577
main = mapM_ (print . isPrime) [2, 17, 25]
>>
>>109592412
its very possible that your mom is actually your dad, but wearing a skirt
>>
>>109592517
>you'll be very unproductive if every change requires you going back to the drawing board
if that's your conclusion then you might be misunderstanding what planning is supposed to be
the plan shouldn't dictate implementation directly, only the abstract goals that have to be implemented

>Even NASA doesn't do that.
NASA doesn't do anything nowadays
>>
>>109594034
>bc specifications cant evolve alongside the project
way to tell someone you never worked on a long term project (like a lib/codebase), without actually saying it
but thats not even the problem

the problem is in the difference between an idealized model and what you end up actually using
>>
>>109594075
ironically, you thinking of having goals in a plan being an "idolized model" only shows your own lack of experience/skill with planning, or any real long-term projects for that matter
>>
>>109594473
no.
its "idealized"

and you clearly dont have the cognitive horsepower, or the experience to take part in this discussion
>>
File: 0a5.gif (3.65 MB, 640x564)
3.65 MB GIF
at least projects I've participated in are well-planned while being resilient to dynamic requirement changes, and not just "beavered"
>>
>>109594589
participating in the project in the capacity of office cleaner doesnt constitute experience relevant to design and planning
>no you
that means you care about em
>>
>>109590825
>(You)
is that actually what rust does? what a retarded language
>>
>>109594646
i grew to believe it has been deliberately made shit and retarded to maximize friction when programming
>>
I have worked out how to directly inject samples into the PS2 SPU2 output.
But to deal with pitch I guess I'll have to work out how to "stretch" or "compress" each sample based on the 44.1khz sample rate of the SPU2 compared to the target period of the wave channel.

And of course, by "directly" I mean copying them to the IOP RAM first and then triggering the IOPs DMAC to copy them into the SPU2 RAM.
>>
>>109592533
>>109592636
>>109592670
The only thing I hate about assembly is that it makes the code non-portable to other OSes because of calling conventions and other ABIs
Extended inline assembly in C is the best of both worlds
int diff(int a, int b) {
int result;
__asm__(
"sub %0, %1\n"
"mov %1, %2\n"
"neg %2\n"
"cmovs %1, %2"
: "+r" (a), "+r" (b), "=r" (result)
);
return result;
}
>>
>>109592023
coroutines inspired by the duff device
https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
>>
what do you think would be cool additions to the C language? and don't say there is no reason to add any, it already has useless things like the do whlle, lets add some more useful things. ill start with the pascal 'with' statement which allows referencing members of a given struct without writing 'mystruct.' over and over again. another cool addition, but very polarizing could be stripped down operator overloading as described by the N3201 C proposal and talk Hello Operator: Making the Call for C (on youtube). what do you think?
>>
>>109587599
Without functional programming, you strip the science out of computer science and becomes just retarded imperative bullshit that a mindless indian can write. Actual functional programming is the real filter separating competent, educated men from techbros and pooniggers.
>>
>>109594802
functionalshit is intellectual masturbation
we have had this discussion even before 4 chan existed

>what if we did programming,
>BUT MATHS
>AND USING ILL SUITED MODELING ON TOP OF THAT

fucking retarded
>>
>>109590665
it is very easy to add a NULL with a macro
 #define concat(...) _concat(__VA_ARGS__, NULL) 

it doesn't matter that it fails for concat(), as it makes to sense to concat nothing

>>109592513
code looks clearer without spamming an array before each call, and often a temporary string is all you need. the relationship between the returned static array and it changing with every call to the function is very simple and should be easily checked by static analysis tools, but the problem is that you can't describe this relationship, so nothing checks it.
>>
>>109594802
>muh science
>muh education
typical functard mental gymnastics: always about useless theory and never about actually getting anything done
>>
>my turing machine is better than your turing machine
classic

Next episode: My text editor is better than your text editor
>>
File: haskell.jpg (13 KB, 474x334)
13 KB JPG
>>109594828
>>109594834
it is actual computer science and not inidan tier javasaar cancer. without at least appreciation for functional programming you are not better than an indian

>>109594838
turing is retarded and a literal faggot
>>
>turing is retarded
>I am using his machine right in this fucking moment
>this means I am retarded, too
:-)
>>
>>109594778
>useless things like the do whlle
What? Why would anyone say do while is useless?
Unless you're going to claim all loop constructs are useless and should be replaced with if and goto.

Sometimes I wish the type system was a little more expressive when it comes to things like VLAs.
Like, in a function, I can write
/* Create a width*height image as a true dynamic 2D array */
int32_t (*image)[width] = calloc(sizeof *image, height);

But when it comes time to return that from a function or put it inside of a struct, there isn't any way to handle this without losing type information. I don't know what that would look like, but it would be neat.
>>
New thread:
>>109594885
>>109594885
>>109594885
>>
>>109594778
>it already has useless things like the do whlle
>she has never written a single program in her life
>>
>>109594838
>t. crab evangelist arguing in another thread why rust is superior
fuck off
also a computer is not a turing machine. it can emulate one but it has more capabilities
and prorgamming languages are yet another thing
>>
>>109594848
>its an actual computer science
just like astrology was.

key term: *was*.
>>
>>109594859
>>I am using his machine right in this fucking moment
a computer has as much in common with a turing machine as you have with with the male gender you nuclear faggot. the turing machine and lambda calculus are equivalent and both are incredibly theoretical and you would know that if you actual read a fucking book. a computer is as much a turning machine as it is a lambda calculus interpreter or a brainfuck interpreter.
>>
>>109594891
ok it is not useless, but nearly every time i find a better while or for loop, at best 5 out of 100 loops area do whiles
>>
>>109594934
>at best 5 out of 100 loops area do whiles
Yes, maybe even less. This doesn't make them useless tho. They are useful for very specific situations. You don't need them often, but without em life would suck big nigger cock
>>
>>109594980
>initialize value to your while loop's expectation
>omagad its anudda shoa
i dont like do-whiles because theyre an alternative notation with almost no added value
>>
>>109594995
do {
input = read();
} while (input != null);


is nicer than something like

input = null;
while (input != null) {
input = read();
}


because with the former you don't have the silly looking pattern of preparing an "invalid" condition followed immediately by checking of that condition, which deliberately does not pass on the first iteration
>>
>>109595070
>invalid condition
someone hasnt got their morning coffee it seems (dw, neither did i)

i find while loops easier to read, the condition is at the top
i wouldnt dislike the pattern nearly as much if it was

do while (input != 0)
{
input = read();
}


but no
condition has to be at the bottom. because the do-while needs to show its deifference into your face
like a fucking zoomie hipster among control structures
has to do things differently because it feels its special
it isnt.
>>
>>109595121
that's a retarded reasoning

and the loop condition being at the end makes sense in that it's checked at the end of the loop and not in the beginning
>>
>>109595158
there is no compiler reason for it be at the end, but visually it makes it clear what is happening
>>
>>109595168
>>109595158
maybe thats the thing?
do while is too close to a vanilla while and so the commitee/dennis ritchie + ken thompson decided to put it at the bottom for legibility sake

i dont like it though. so i dont use it.
call me deeply prejudiced, i ll wear it like a medal
>>
>>109595284
its a fucking loop my nigga, do you need a "do while hater" shirt too?
>>
>>109595345
i wouldnt mind one.
sounds like a possible conversation device



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