[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] [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: chair.png (475 KB, 800x740)
475 KB
475 KB PNG
What are you working on, /g/?
Previous: >>107417196
>>
File: 1739031807293205.png (166 KB, 1242x1460)
166 KB
166 KB PNG
>>107456434
>What are you working on, /g/?
>>
>>107456434
using cpp for programming; game-dev
>>
I am trying how to CI a platform that have 2 different repos for backend and frontend, working on top of supabase for Auth, DB, and Storage
>>
>>107456487
leetcode challenges are discriminatory against a proper OOP approach
you always get barebones arrays instead of a proper interface
>>
>>107456487
Are these types of coding challenges fun should I be doing them? They don't seem very fun to me.

>>107457432
I hope this is a joke.
>>
>>107457469
>Are these types of coding challenges fun
they become fun after you've learned most of the algorithms and structures you need to solve them, then it becomes a challenge of using your tool deck to find a solution.
So expect the first 100-150ish problems to be a chore until you get into the rhythm.
That problem is fucking absurd. It requires a dequeue, sliding window algorithm, dynamic programming, and prefix sum.
>>
>>107457504
>So expect the first 100-150ish problems to be a chore until you get into the rhythm.
>That problem is fucking absurd. It requires a dequeue, sliding window algorithm, dynamic programming, and prefix sum.
I'm sure these are all useful things to have in your mental toolbox, but I think I'll just rather spend my time solving my own problems.
>>
Alright, made an sdl3 Atari style game with music and sound effects using the experimental sdl_mixer (think i even found a bug in it).

What now? I love learning new things, but I don't really have anything in interested in making.
>>
>>107455298
kys nocoder nigger troll
>>
>>107458155
confirming my point, thanks
>>
CHALLENGE: given 64-bit unsigned integers x, n and d, calculate the correct (x*n)/d, where (x*n) might overflow
>>
>>107458746
divide everything by 10, multiply result by 10
>>
>>107458746
in Haskell this is just fromIntegral :: Int64 -> Integer
>>
>>107458746
(__uint128_t)x*n / d
if there's a faster way to do it, gcc will optimize it to that.
>>
>>107458815
msvc can optimize umul128 to a div instruction, but clang and gcc dont optimize shit
>>
File: 1751966116561410.png (375 KB, 2655x1114)
375 KB
375 KB PNG
Render graph creates and transitions resources reasonably well.
>>
I got hugged... by a girl!
>>
Huh, I've been shitting on mingw for not having address sanitizer, but I think llvm-mingw actually has address sanitizer.
https://github.com/mstorsjo/llvm-project/commit/gha-mingw-compiler-rt
more info here
https://github.com/llvm/llvm-project/pull/159618
I also shit on mingw gdb having a bunch of problems related to how it behaves with aborts or exceptions, but maybe lldb is different (and I know that sentry somehow manages to work with mingw, so my excuse that mingw is bad because no post-mortem debugging / reporting is wrong, BUT I really like windows time travel debugging and you can set a folder to dump crashes to using the registry, which I like a lot which won't work with GDB, BUT... does llvm-mingw support msvc style debug info? AKA coff/pe I think? since that means it would work with all the default msvc tools)
>>
>>107461834
>does llvm-mingw support msvc style debug info? AKA coff/pe I think?
It might be a build-time option. Internally, it prefers ELF/DWARF, but that doesn't mean the disk format needs to be that.
>>
>>107457432
>you always get barebones arrays instead of a proper interface
leetcode stuff is usually just about smashing things together fast
getting good data models is a more thoughtful task, and OOP is one of the approaches there; that task tends to be too slow for the uses of leetcoding, but ultra-useful when doing long-term support for an app
programming isn't just about shitting some code out fast; if that was all we wanted, we'd vibe code the lot
>>
>>107456434
legs.
also i done picrel recently
ill post full code if cloudflare doesnt fuck up
>>
https://github.com/karpathy/reader3
>ask claude to write an epub reader
>slap the word AI on it
>doesn't actually have any AI integration
>it's literally just an epub reader like any other but """easier""" to copy paste into an llm chat (it's not)
>get 2.5k stars

im starting to think AI is brainrotting supposedly intelligent people
>>
>>107463810
forgot piglre
cloudflare didnt fuckup tho
https://files.catbox.moe/d0zh7z.tar

its a server/client solution for arduino, in c
basically all the boilerplate one would need, when wanting to connect loonis to the duino

more or less
this should work
discrete elements do work, maytbe i fucked up something along the way idk im currently too drunk to do anything about that

its a working version anyways
ill post again when ill have something that ould be usable oob
>>
>>107461775
I don't believe it.
>>
>>107465564
She's one of my former classmates. I might just call her up. There's hope for all of you lonely incel losers, mes dear anons. Imagine if a guy in a country where up until a few years ago, male-female contact was a no-no can get a chance at a probable relationship, you in more hedonistic, immoral parts of the world are surely locked in. You just have to hold yourself to value, and respect women.
>>
File: angry-emoji-hat.png (346 KB, 1024x1024)
346 KB
346 KB PNG
>>107465733
btw, I do call you homofaggots 'immoral', but I just found out one of my FORMER friends has divorced his wife, became gay, and now lives in Tehran's Jannatabaad with ANOTHER MAN. AS LOVERS. Why is he not getting executed is probably because he lives in a 'chique' neighborhood. I think it might be where all the faggots live. Please, Israel, nuke that neighborhood. It's next to Punak.
>>
>>107465733
>platonically touched by woman
>suddenly thinks he's unlocked some ancient wisdom
kek
>>
>>107465786
The reason I'm calling her up has nothing to do with her hugging me you doofus. She was always sweet on me, what you Westoids call 'The Girl Next Door' --- and in the past few years I've often thought of her, but she was unavailable. Now she is available.

I'm 32 my man, I'm not devoid of female touch. I'm just a bit unsure that she'll be receptive, so I led with that.
>>
File: 1763487910513252.jpg (21 KB, 400x400)
21 KB
21 KB JPG
Got her number.

What do I tell her. I usually act like a pest towards girls and insult them and be snarky. It's never worked. This time I'm going to act different.

She's fluent in English. Give me something to slide in with. Like, how about the discrepancies in Claude Lanzmann's "Shoah" documentary, as noted out by magnum opus "One Third of the Holocaust"?
>>
>>107465821
touching story, try not to freak her out too much
>>
File: thinking-emoji-goth.png (530 KB, 1024x1024)
530 KB
530 KB PNG
>>107465882
I don't know what sorta stuff she's into. She has a master's in English literature, but she hates the field. As it happens, I know a lot about English literature. How about leading in with this New Testament verse:

"For now we see through a glass, darkly; but then face to face: now I know in part; but then shall I know even as also I am known." -- First Coronthians, 13:12

Or this Old Testament verse:

"Wildcats shall meet with hyenas, goat-demons shall call to each other; there too Lilith shall repose, and find a place to rest." -- Isiah 34:14

Bible is part of the Western canon, despite having been written by ARAB JEWS.
>>
>>107465935
tell her you want to wear her skin. serial killers always make their pussies wet
>>
>>107461834
huh, I think technically this existed for a while, this isn't new... and it does pretty much everything I was asking for.
It all just worked with msys2 (vcpkg x64-mingw-dynamic / static)
LLDB can open core dumps made by msvc tools (BUT msvc tools won't work, only the dump in lldb will...).
The IDE terminal has color now.
this avoids the Visual C++ Runtime dependency.
And llvm-symbolizer supports msvc's sanitizers as well as the dwarf info in llvm-mingw.
Overall, there are zero problems, it's actually a perfect alternative to msvc (except for setting it up, msvc still just werks).
>>
>>107465868
Will probably work, but if she thinks you are joking then pivot to hooking up for sex as fast as possible
>>
>>107456434
looks even better with that hot chink on it
>>
>>107461834
Sir, you're supposed to poo in the loo, sanitizers have no usecase if you don't smear your shit everywhere.
>>
How do you deal with strings in UTF-8 where characters have variable byte width? Is it right back to C style strlen_utf8()? Editing a string buffer must be a pain.
>>
>>107466466
You pay the cost in the part of your code where you actually have to interpret the data or render it so humans can understand.
Completely useless to worry about it otherwise.
>>
>>107456434
I want to write an operating system + a language for that operating system with rust.
What are some resources to do this. Don't say AI. AI is slop. I want blogs boox, doesn't matter if it's in C/C++ I'm fairly confident I can translate them into Rust.
>>
>>107466466
Use a higher‑level string type (Rust String, Go string, ICU, etc.) that hides the variable‑width details.
>>
>>107466661
>Rust String
>hides the variable‑width details
how can anyone be this fucking retarded
>>
>>107466466
>How do you deal with strings in UTF-8 where characters have variable byte width? Is it right back to C style strlen_utf8()?
That entirely depends on what you want to do.
Measure it's size? Code units count? Graphemes?
>>
besides compiler optimizations, why do people like to shit on exceptions?
It’s better than runtime asserts in every way since you allow the user to catch it if they want to.
>>
>>107456434
I'd lick her feet all day every day
>>
>>107467354
>why do people like to shit on exceptions?
Unwinding is slow and exceptions are form of hidden control flow. You never really know when they can appear and what sort of exceptions could be thrown by a function.

>It’s better than runtime asserts in every way since you allow the user to catch it if they want to.
Asserts and exceptions are orthogonal.
>>
File: 1764874508373378.jpg (181 KB, 802x904)
181 KB
181 KB JPG
rate my new functional, declarative c++ framework using "reflections". still wip obviously.

https://github.com/KnurrliDev/TBT
>>
>>107467354
If you're even comparing exceptions to runtime asserts you're doing at least one of them wrong.
>>
>>107467562
Has anyone remade serde in C++ using reflections yet?
>>
>>107467589
glaze? remember reflections are not supported yet, so all reflections are extreme hacks and compiler abuse
>>
>>107467354
It all begins with incompetent implementations.
If you care about performance or code size at all, you cannot use them.
>>
AI just gave code that deleted all my path entries for no reason. And I ran it without checking. Fuck this shit.
>>
>>107467740
>remount old snapshot
>nothing ever happened
>>
>>107467562
Is this a task system as in multithreading?
>>
>>107467740
A vibe coder gets what he deserves.
>>
>>107467786
Do you need to set up a btrfs partition for this?
>>
>>107467803
no, common misconception because of the word task.
fulfils a similar role like an entity component system or an agent system like in ue5 etc. all tasks are run on the main thread and can run from 1 to n frames.
the use case ranges from very long running tasks like rendering to 1 frame long tasks ("I want to run this code quickly on the main thread").
it's all about flow control in larger programs, convenience and composition. but instead of oop shit and tons of boiler plate you can do it declarative and functional.
that said you can easily write an awaitable for something like taskflow and co_await on it in tasks.
>>
>>107467786
>>107467820
I'm on wangblows. I did manage to restore it because there was a separate terminal window that I opened ages ago that was still running. I was able to get the path from there and restore it to that state.
Never vibing again. This shit is a scam.
>>
File: 1752186453547486.png (173 KB, 1067x1396)
173 KB
173 KB PNG
>>107456434
What the fuck does this mean? (This is from Modern C by Jens Gustedt, the topic being the use of the [[deprecated]] attribute when writing a interface)
>>
>>107468684
there is no such thing as modern c.
>>
>>107467595
bloomberg's had a provisional implementation of p2996 and related proposals for ages which all the hype posts about reflections examples are using
their <meta> aside from using all their new builtins is pretty heavily reliant on the current constexpr/consteval behavior specific to clang's libcxx and last i tried to make it properly work work with stdc++ both required a fair amount of tweaking
>>
>>107468755
>t. rustranny
C23 has type inference through auto and typeof, nullptr type, default initializers, function attributes, _Generic macro for generic functions, bit precise integers through _BitInt(N), ' as digit separator, etc etc.
>>
>>107468684
I don't know the context but I'm guessing it's to make sure people aren't using deprecated shit directly just the actual interface so said implementation can be changed but as for why not simply not allow access to the implementation in the first place since preventing others from depending on it is kinda the point innit?
Who knows, that's a weird book anyway.
>>
>>107468883
>_Generic macro for generic functions
_Generic isn't and has never been actual generics it's closest to function overloading if anything
>>
>>107468969
That's funny, because using __VA_ARGS__ in macros is still less retarded than trying to use _Generic
>>
>>107467472
>>107467564
> Asserts and exceptions are orthogonal.
returning an error code and checking it with a runtime assert is literally the same behavior as throwing an exception and not catching it.
the “hidden control flow” excuse is just bullshit.
>>
>>107468883
this is not modern but 30 year old shit. c itself is deprecated and only used in some ancient embedded shit. there is literally 0 reasons not to use c++
>>
>>107469035
assert is for checking internal states (programmer error)
exception is for handling external errors that the program has no influence on and may or may not be able to recover.
>>
>>107469035
>returning an error code and checking it with a runtime assert is literally the same behavior as throwing an exception and not catching it.
No, exceptions are hidden control flow, involve unwinding and are not part of function signature.

>the “hidden control flow” excuse is just bullshit.
Not an argument.
>>
>>107469102
hence asserts are just throws you don’t catch, there is no other difference.
>>107469112
> Not an argument.
yeah, that’s exactly what I said.
>>
>>107469140
>yeah
Good to reach an agreement. Cheers.
>>
i wish i had a cpu with uintr support i would just use them instead of exceptions, error codes, or normal non local gotos for error handling
>>
>>107469090
Ywnbaw but post your boipussy if you are cute
>>
>>107469140
just because they have an overlap in behaviour doesnt mean they are the same.
>>
>>107469312
if you can justify one over the other because of how the compiler implements it, that is fine. but returning an error code from a black box function is no different from throwing an exception.
you are just reimplementing exceptions in your own way.
>>
>>107469419
if you cant understand two completely different concepts wtf are you even doing here
>>
>>107469640
explain it then, in a way that doesn’t resort to the social construct created around how you particularly use them.
>>
>>107469690
internal and external errors as like 10 anons already have explained to you
>>
>>107468684
https://www.youtube.com/watch?v=qtaCqU5yY9Y
>>
>>107469734
you fail. wanna try again? or are you just gonna accept it is a social construct?
this isn’t even the thing I care about though.
>>
>nocoders arguing over error handling again
>>
>>107469140
>hence asserts are just throws you don’t catch, there is no other difference.
an exception unrolls the stack and is practically useless for debugging
>>
>>107469690
Java uses Exceptions and Jeets use Java therefore Exceptions are used by Jeets.
>>
>>107469996
They also use variables
>>
>>107470001
My data isn't variable.
>>
>>107469993
that is a pain in the ass indeed, but if you have a bunch of nested functions returning error codes in sequence, it is doing fundamentally the same thing, no? unless you sprinkle break points around, you won’t find were the error came from.
>>
>>107470029
No it isn't.
>>
>>107470029
No, unwinding is significantly slower.
>>
File: 1751556373568295.png (86 KB, 765x601)
86 KB
86 KB PNG
Error code branches might be free of latency but you're still generating heat. Exceptions don't even touch the branch predictor.
>>
>>107470109
>Exceptions don't even touch the branch predictor.
Dumb nocoder.
>>
>>107470109
From the caller side*
>>
>>107470142
Nitpicker loser.
>>
>>107470062
the claim was about it being useless for debugging though
>>
>>107470163
Not a nitpick, optimizing compilers move the checks up out of the callee. In the end, you have equivalent amount of branches in final executable meant to execute in production.
The difference is that exceptions can boil you some water for a cup of coffee when they do happen.
>>
>>107470193
Ah, then it's not very different, but that depends on language. Eg Rust exceptions (panic) have backtrace, but errors passed by return value do not, unless you explicitly include them.
>>
>>107468684
You define the structure in the .h file with each member having the deprecated attribute so that the user of the library gets screamed at by the compiler for using it directly; but as a result of this you have to define your functions in the .c file as deprecated too to stop the compiler's complaints when they access the structure; however, since you didn't use the attribute in the declaration in the .h file, the library's user can call the functions without any warnings — though they have [[deprecated]] in the definitions.
>>
>>107468684
Books written by C committee guys are uniquely awful.
>>
>>107470416
They will do ANYTHING to spite C with classes, fucking pathetic language
>>
File: videoframe_2641214.png (480 KB, 1280x720)
480 KB
480 KB PNG
>>107469993
https://www.youtube.com/watch?v=dZzmtHXJN7A
but I don't agree with anon with assert being the same as a c++ exception, but I think the standard library implements exceptions as a substitute for asserts, but when you disable exceptions, the standard library will substitute the throw with an abort, I think.
I don't think exceptions make any change in performance, maybe a synthetic benchmark will show that the cost might be like 1 nanosecond extra per function call that's not inlined with a destructor.
But the cost of carrying a return value is likely to add the same overhead, because C++ exceptions don't directly impact the code that is being executed (unless you add a try{} frame? I think? if you don't catch any exceptions, will have exception unwinding code sections, but those sections won't get executed).
For example this video:
https://www.youtube.com/watch?v=rHIkrotSwcc&t=1162s
If you compare back and forward what happens before and after noexcept, you will notice that the code for the exception handling is never called, it' just sitting in a place where it can't be executed (the exception handler does not start at a branch, it's the code after the return, I think?).
If you really think enabling exceptions gives a huge overhead, why don't you just benchmark it?
>>
I'm studying java, python and C.
>>
>>107470639
Actually nevermind, if you disable exceptions it still uses the throw call, it just does the default behavior when you throw in a noexcept function or not catching.
>>
>>107470639
>global state
>>
>>107468883
>' as digit separator
even in 2023 they still make retarded syntax decision
>>
>>107470416
Thanks
>>107456434
I have another question, do you need to use offsetof while malloc-ing only when allocating for flexible length arrays in structs? Or do you need to account for the offset in every struct allocations?
>>
>>107470792
>if you disable exceptions it still uses the throw call
Did you compile stdlib++ with exceptions disabled or did you imagine this?
>>
>>107470859
Oh, I didn't think you could build the C++ library with exceptions disabled. What do you get in your debugger when you do that?
I just disabled exceptions with -fno-exceptions and expected it to do something, but the stacktrace inside libc++ is the same.
ucrtbase.dll`abort
libc++.dll`__abort_message
libc++.dll`demangling_terminate_handler()
libc++.dll`std::__terminate
libc++.dll`__cxxabiv1::failed_throw
libc++.dll`__cxa_throw
libc++.dll`std::__1::__throw_out_of_range[abi:ne210107](char const*)
>>
>>107470985
No idea, I never used -fno-exceptions without also using -nostdlib -nostdlib++ -nostartfiles.
But if you compile stdlib++ with exceptions a nd call it from your exception free code, it's still using exceptions obviously.
>>
Why is there no language you write as if it was garbage collected, that then uses runtime information to rewrite itself as if it had explicit calls to free/delete?
>>
>>107470985
> Disabling Exceptions: If exceptions are disabled via compiler flags (e.g., -fno-exceptions in GCC), the throw instruction results in an automatic call to std::terminate() or abort(), as the mechanism to find a catch handler is unavailable.
just like an assert
>>
>>107471197
you’d need 100% code coverage for that
>>
File: screenshot.png (5 KB, 788x320)
5 KB
5 KB PNG
>>107471199
in GCC, my own code doesn't even compile unless I remove throw.
>>
>>107471197
explicit calls to free and delete would be slower than garbage collection
>>
>>107471249
For throughput that's possible, but calls to free/delete brings other guarantees: Memory usage won't be so spiky and you won't have long pauses either
>>
>>107471263
Memory usage is always spiky, nobody releases memory to OS on simple free.
>>
>>107471197
Pick a language supported by GraalVM and you're halfway there.
One day it might be real.
>>
>>107470729
Stop studying java and replace python with perl/raku
>inb4 dead language
>>
>>107456434
Is there a "definitive" version of C++ in that it doesn't feel like a hodge podge of different bullshit but a rather well thought out language, maybe C++11?
>>
>>107471371
It's not just dead, it's absolutely shit too.
>>107471416
Hey you fucking retarded faggot, try writing good code and it won't look like hodge podge of different bullshit. Sorry that I cannot say the same about Perl, I read Minimal Perl by Maher and it didn't help.
>>
>>107471416
Just use a reasonably modern version like C++17 or C++20 and don't use the parts you don't like.
>>
>>107471235
this compiles just fine, and terminates when the exception is thrown.
#include <vector>

int main(){
std::vector<int> v(1ULL<<60);
printf("%d\n", v.back());
return 0;
}
>>
>>107471416
(C++98) (C++11, 14, 17) (C++20, 23) (C++26, ???)
>>
>>107471197
Determining the lifetime of an arbitrary variable is undecidable.
Therefore you get:
- Rust (lifetimes must be specified)
- Swift (reference counting)
- Garbage collection (mark and sweep, moving, non moving, generational, etc.)
- Linear types (in Haskell, Austral) (the compiler ensures you call a delete for each new, to consume the type)
- Vale (single ownership to avoid gc, generational references to avoid borrow checker but adds runtime cost)
>>
>>107471437
>it's absolutely shit too.
>t. never written a single line of perl code and all you know about it is from some retarded redditor
>>
>>107471481
Moral of the story: keep std's out of your life.
>>107471512
>didn't mention arenas
>>107471520
>Maher is just some redditor
yea ok I'm sure some random 4cuckcel will change my mind
>>
>>107471534
You have to free arenas yourself and it's not compiler enforced.
>>
>>107471545
There's no reason why a compiler couldn't cope with hard to solve lifetimes by using an arena.
It's just a matter of some minimal restrictions and programmer telling some things to the compiler.
>>
>>107471512
>Determining the lifetime of an arbitrary variable is undecidable.
That doesn't sound right. If humans can do it then there's logic to it and a machine can do it as well.
>>
>>107471600
The problem is that retards who are the reason why GC needs to exist cannot logic like that.
>>
>>107471371
>>107471437
>Perl
is absolutely not bad if you're disciplined and not obsessed with keeping loc down. you can write perl that looks like C, even. as a bonus, it's stable.
>>
>>107471645
>you can write perl that looks like C
If I wanted any more C in my life, I'd just write C directly.
>>
>>107471581
It's not hard to solve, you can't solve it for every program. You have to guarantee that whatever you shove into the arena doesn't keep existing after.

>>107471600
No, humans can't do it for an arbitrary program. As Tony Hoare put it: either the program is so simple that obviously there is no deficiency, or there are no obvious deficiencies.
If you disagree then tell me if the folloing program terminates for all inputs:
https://github.com/twseptian/Operating-System-Codes/blob/master/3.14_collatz-conjecture.c
>>
>>107471600
Not true at all. A human can make an assumption about which outcome we expect whereas a compiler would have to try both outcomes and pick the one that is correct. If you want runtime checking you are already looking at garbage collection.
>>
File: aw_jeez.jpg (17 KB, 300x358)
17 KB
17 KB JPG
>>107469035
>asserting on error codes
>>
>>107472088
when fopen fails, I spinlock my program and pull the power cable of my computer.
>>
Also while mentioning arenas, there is region-based memory management work.
MLKit does region inference, but keeps a gc running for edge cases where inference fails, one alternative forgoes the gc and keeps the edge cases alive until program termination.
Cyclone, based on C, also has regions but you have to name them. They also have a gc for things that fall outside the regions into the heap, because they have a complicated lifetime (shared mutable data between regions, third party library allocations).
ParaSail also uses regions and has no gc. But you can't juggle pointers and the performance gained might be dunked on by the semantics of poorly parallelizable programs.
So, all in all, compilers can't simply use arenas.
>>
>>107472088
What do you do when epoll_create1 fails?
>>
>>107472372
Most languages makes assertions disableable, often via some debug vs release mode or whatever, or in C's case, just a macro.
So you're making a runtime check that is disableable at compile time.

Just do the damn check properly. If you really want a "just die now if this fails please", just make a function or a macro for that, which then calls abort(). Don't use assertions.
>>
>>107471371
>replace python with perl
based
>>107471645
>is absolutely not bad if you're disciplined and not obsessed with keeping loc down
exactly

Good perl code looks absolutely fine. The sigils on variables even allow the syntax highlighter to use a different color for functions and variables and it makes the program very readable.

List processing in Perl with grep, map and sort is a lot more readable than in Python. The lambda/block syntax is very readable compared to Python's noise.
>>
>>107457207
What is the best language for coding pls I start with python but I don’t understand a fcking thing
>>
>>107472878
>just make a function or a macro for that, which then calls abort(). Don't use assertions.
not anon, and I think epoll is a terrible example because errno has an error message to print (you can make a custom assert that prints errno, or GLE, or a library code however).
But if you are a C developer, I understand that assert is not good. Because it's very ugly to do:
value *ptr = malloc();
assert(ptr != nullptr);

Because if you are never going to handle malloc, you might as well make a custom malloc wrapper that will assert for you (with __FILE__ & __LINE__).
And if you already return error codes, you might be tempted to just return out of memory as an error. But the harm is that you lose the location of the error, because unless you are normally loading 10gb, it's a bug.
The times when I use assert is for sanity checking. Like random stuff like making sure the string is null terminated or null ptr checks (and it feels like 80% of my asserts are just null ptr checks, I think if I used constructors & exceptions + string_view, I could avoid all of those asserts).
There is also some neat things you can do with C++26 contract assertions, which are just fancy asserts that you can check things before and after the function is called (sometimes I have a function that is a 1-liner, this is very annoying to put an assert into here, and in I can't use __LINE__ and __FILE__ because it's in a class member function, so I use std::source_location which works, so I can get the useful location if I had an error without a debugger, but I can just use contract assertions!). And I believe contracts are const only, so you may still need regular asserts sometimes.
https://www.youtube.com/watch?v=oitYvDe4nps
There is also [[assume(x)]], which is like the unreachable intrinsic, which you should not replace your assert for even if you could, but it would be interesting to see if you swapped your assert with assume() and got a noticeable perf improvement.
>>
>>107461775
A 4chan user getting hug by a girl ? I don’t believe it
>>
>>107473355
Dude.. What are you using to learn python? If you're getting filtered by python, it's going to be an uphill battle.
>>
>>107472369
>it's all or nothing
>>
>>107473410
It’s bc that’s what we learn in class rn bro but I want to use something else
>>
>>107461775
then get out
>>
File: 1659490555360836.jpg (46 KB, 531x578)
46 KB
46 KB JPG
I have more bugs than I started with.
>>
>>107473699
Roll back and try again.
>>
>>107457469
they're super fun ngl
honestly it's way more enjoyable than actually building something imo, and that's make them kind of dangerous since you can easily sink 10 trillion hours into grinding stuff that's not useful at all unless you want to work at fagman
>>
File: kjjcrhu813c.png (561 KB, 800x635)
561 KB
561 KB PNG
>tried to implement a simple, functional library for my Lua code
>even looking at 'Lua Fun' source code in github, everything is iterator base
I really like how clean and pristine 1 line code looks in functional
I wanted that in my code, without importing libraries
but I'm too retarded to do it
>>
>>107474281
>honestly it's way more enjoyable than actually building something
I can't imagine this to be true.
>>
>>107474412
why not?
i also love solving eulers too
>>
>>107474386
Lua can store and pass functions around, what's the problem?
>>
>>107474439
Because actually building working stuff that you can and do use is a great feeling.
>>
>>107474473
maybe i'm just an uncreative bugman but I can't enjoy building anything that for which there already exists a usable alternative, and most of the things that I wish were real are too hard for an idiot like me to make anyway

also I have a short attention span
>>
>>107466638
Phil Opperman's blog series where he writes an OS in rust is good.
I learned OS internals by doing the MIT xv6 labs.
>>
>>107474541
>I can't enjoy building anything that for which there already exists a usable alternative
This should be a valid argument, but I can't take it seriously in a discussion where the alternative is grinding artificial exercises. Using something that you built yourself is a special feeling.
>>
i have 2 weeks off work over xmas and I don't really know what to do tbqh but I feel like doing something g related
>>
>>107474701
gameboy emulator
>>
>>107474626
Those artificial exercises are special to me because they rely on fundamental algorithmic techniques. It's difficult to explain, but it feels more like I'm solving discrete maths problems rather than advant of code problems.
>>
File: cheers.jpg (28 KB, 672x372)
28 KB
28 KB JPG
>>107474887
>>
>>107474782
if they know opengl, psp emulator would be a million times more interesting
>>
>>107475457
>more interesting
that's subjective, depending on which console you care for, but a PSP emulator is a way more complex task I'd imagine.
How good/complete is the documentation and RE for the PSP's GPU?
>>
File: j3io23c.png (313 KB, 661x452)
313 KB
313 KB PNG
>>107474465
>lua
>defold
I know I can make maps, filters and slice/takes for my project, code that meets the required behavior for the project that I'm working it. I'm bad at coding but I try to make it efficient
but the more I try to 'abstract' the functions (to make it more generals/universals, to be use in other projects) the more I realize how important having a base in iterators would make sense
It's not about being a purist and turn everything immutables, functions and pipelines mean, it's not a bad idea that everything should be a pipeline (maybe functional prog. brainwashed me)
but having "certain part" of the code in full functional programming would make my life sooo much easy
the big problem is I'm not smart or good at coding, but I don't wanna end up with a bad code
>>
>>107469140
No, an assert failing should not be the same as an exception. An assert failing tells you that you've entered an invalid state. The only safe thing to do is terminate the program, possibly restarting if it makes sense. Unchecked exceptions are just bad design. They are non-local hidden control flow, arguably worse than goto's in unstructured programming.
>>
>>107475978
>arguably worse than goto's in unstructured programming
lol no; you have no idea how bad they get
>>
>>107475978
>An assert failing tells you that you've entered an invalid state.
> Unchecked exceptions are just bad design
you decide if you want to check them or not. you decide if the exception represents an irrecoverable invalid state and that the program should die, or not.
the default behavior is dying, like an assert. that’s just it.
> They are non-local hidden control flow
a throw statement is just as “hidden control flow” as a return statement or as an abort statement.

all I’m seeing is that you don’t like the name “exception” so you use other things to achieve effectively the same result.
>>
>>107476468
Unchecked exceptions are exceptions not explicitly annotated and checked by the compiler, i.e. you can't tell from a function signature whether the function throws, and callers don't have to explicitly either catch the exception or rethrow it and annotate that it can throw in its own signature. It's essentially the equivalent of a dynamically typed function. What does such a function return? Who knows! What exceptions does this thing I'm about to call throw? Who knows! Trying to write reliable software in a language with unchecked exceptions is as retarded as trying to write it in a dynamically typed language.

>a throw statement is just as “hidden control flow” as a return statement or as an abort statement.
A return statement is not hidden, whether something is returned, and what that thing is, is indicated in the function signature, and you can often annotate that the return value should be checked so that callers are forced to handle error conditions. Asserts and aborts are not for control flow, they terminate the program to prevent catastrophic damage once an invalid state is detected.
>>
is the structure of json/yaml/xml in binary standard? like is there only one right way to store json as a binary object? or are there different opinions?

if i wanted to make a super converter for json-yaml-xml that could convert to/from any, would the project be comprised of [lang]->binary and binary->[lang] procedures?

i mean i guess theres probably a way to do this with regex but in the sense of "real" parsing techniques
>>
>>107476735
Sir, json, yaml and xml are text-based formats.
>>
File: 1736465441123624.png (944 KB, 6189x6189)
944 KB
944 KB PNG
>>107473355
Start with the camel
https://files.catbox.moe/sdgar1.epub
>>
File: time.png (208 KB, 1047x533)
208 KB
208 KB PNG
>>107476735
It's all in binary.
>how does serde and pandoc work
They have an intermediate representation that can represent all formats and allow you to go from one to another with data loss if the final representation is less expressive than the initial one.
>>
>>107476721
I agree with complaining that the exceptions thrown are not listed in the signature of the function, java already does it.
but when you return error codes you also don't know what are the available error codes. you assume, by convention, that the value "zero" means no-error, and then you have to check the documentation of the function to see what are the other available error codes.
it is no different from having to check the documentation of a function to see what exceptions it throws, but exceptions are better because you don't have to assume anything about the no-error state.
>A return statement is not hidden
a throw statement isn't hidden either. it's in the code, in the same place you'd expect a return or an abort. besides, functions are black boxes, you don't have to know what is inside.
>you can often annotate that the return value should be checked so that callers are forced to handle error conditions.
exceptions do that during runtime: you are forced to deal with the exception or the program dies, which is better than not checking error codes and letting the program continue in a faulty state.
forcing the catch during compile time would be nice indeed. java already does it.
>>
>>107476959
it's not all binary if you dont actually have an interpreter, and are just thinking about these formats as syntax in an abstract sense. actually i'm being retarded because then they wouldnt be known languages.
obviously json defines JS data and theres only one shape that can take as binary. and i guess i was trying to ask if json->yaml has a single representation and it seems like no it doesnt.
>pandoc, serde
so their intermediate representation would probably be the MOST expressive, right? and necessarily it would be binary temporarily within the program, but youre probably saying theres no point in making a json->binary or yaml->binary because they already "are" that.
so but the intermediate representation in a json->yaml conversion might not actually be the same as that json in JS. it would have extra space and empty indexes for the highest expressiveness.
>>
>>107474554
I've seen it. Seems to be the gold standard for writing OS with Rust.
>>
im writing a chess engine to learn c++ right now.
i wrote a really shitty one in python in college when thats the only language i knew and it could only get to a depth and was really dumb.
also doing the advent of code problems in c++ which have been pretty easy so far
i majored in engineering in college and ive been learning cs in my spare time and i honestly find it way more interesting because i can put concepts to the test on my computer
as opposed to learning engineering where its all just theoretical shit until you get to industry (which im struggling to get to atm)
>>
>>107477391
>as opposed to learning engineering where its all just theoretical shit until you get to industry
don't you have lab classes
>>
>>107476936
Ok thanks
>>
>>107477411
yea but the most interesting one outside of capstone we just pulled apart a metal bar and measured stress/strain
idk if you consider this a lab, but i took a computational fluid dynamics class and we wrote a fluid sim in fortran. that was probably my favorite class in the entire curriculum
>>
>>107477470
>we just pulled apart a metal bar and measured stress/strain
I guess it is mechanical engineering then, because in electric engineering you get to play with assembly/c to control motors.
>>
are there any ready-made task templates for zed? I don't want to write them myself.
>>
>>107472878
I see no value in checking value of epoll_create1, because if my production server is out of RAM during its startup, I'd love to get fired for my buggy code, actually.
>>
>>107456434
You look like a drooling wheelchair retard with that setup.
>>
>>107473368
In context of C, this means you have to write and maintain a multiline macro, and return a value from it, how do you do it in case you aren't fortunate enough to have a good compiler that fixes most of standard C's issues?
>>
>>107476721
>What exceptions does this thing I'm about to call throw? Who knows!
that's a problem with some """smart""" developer using unchecked exceptions because it was more convenient for him at the time
and even if that happens, it's still easier and cleaner to handle than a return value that might be either a status code or an actual value

Java did it right: you wouldn't want to see every every method either explicitly throw or catch NullPointerException, IllegalStateException, NoSuchElementException, NumberFormatException, etc., because that would be just noise and you would be more likely to just catch-all at all points, adding even more noise

>Trying to write reliable software in a language with unchecked exceptions is as retarded as trying to write it in a dynamically typed language.
skill issue; Java is very reliable

>A return statement is not hidden, whether something is returned, and what that thing is, is indicated in the function signature, and you can often annotate that the return value should be checked so that callers are forced to handle error conditions.
you're just reinventing checked exceptions but mixing status/meta-control into the business logic
i rather deal with the possibility of unchecked exceptions

and you can still add a "throws [unchecked exception]" to a method signature for extra clarity or mention it in the method's javadoc
>>
>>107477011
>you assume, by convention, that the value "zero" means no-error
I remember using glfw which doesn't explicitly state what GLFW_OK is so I just stuck to writing GLFW_OK != result everywhere because what else can I do?
Fuck cniles.
>>
>>107478391
>you wouldn't want to see every every method either explicitly throw or catch NullPointerException, IllegalStateException, NoSuchElementException, NumberFormatException, etc.
Not him, but I would actually.
I'm really scared when they say things like "There might be Java in your credit card" but also allow you to be sloppy.
MISRA Java when correctness really matters or gtfo out of my sight.
>>
>>107478418
>Not him, but I would actually.
then you're free to annotate methods with explicit throws of those
>>
>>107476735
Not sure I understand your question, but traditional SQL databases exist for exactly this purpose, I hope whatever you do, you decide to stick to storing your data in a database and pulling it out when you need to instead of doing something very retarded.
>>
>>107476735
>is the structure of json/yaml/xml in binary standard?
they're text formats, the "binary standard" would be like any other text file, ie. data with character encoding like UTF-8

you could build some kind of binary DOM or property map out of them but then it wouldn't be json/yaml/xml anymore, it would be your own DOM (or someone else's DOM if you use a library)
if you want to build a generic converter, you will probably need your own transitional format anyway
>>
>>107476735
if you just want to store, can't you use sqlite?
if you want to send data to someone, can't you just use avro or protobuf?
>>
>>107478552
>avro/protobuf
Nobody gets to choose these things, average retard expects you to use json or xml.
>>
>>107475913
>but I don't wanna end up with a bad code
If you're bad at coding then the only alternative to this is to end up with nocode. And that certainly won't help you get better.
>>
>>107475978
>Unchecked exceptions are just bad design.
So is using assert() for error handling.
>>
>>107479289
As usual, Go was right about everything.
>>
types could have prevented this
>>
>>107479312
I'm not familiar with Go to understand this reference.
>>
>>107479325
To be fair, you have to be very high IQ to understand the reference to the cloudflare .unwrap() incident that could've been avoided by if err != nil which would've reminded the programmers that hey, maybe the config really should be checked just as rigorously as we just wrote that if err != nil chain.
>>
>>107479405
java could have prevented this
>>
>>107479405
But what does this have to do with Go?
>>
>>107479405
>could've been avoided by if err != nil which would've reminded the programmers that hey
That's what unwrap does under the hood.
>>
>>107480052
It doesn't, .unwrap() allows being haphazardous faggot.
>this will never happen
>we will never have broken config in production
>who car-ACK!
>>
Obviously meant >>107480115 for >>107480108
>>107480052
Go is annoying to program in, you constantly deal with every single err != nil and it's always on your mind, you cannot .unwrap() and not care.
>>
>>107480125
That does sound annoying. I hate how Java forced me to catch all exceptions. That just led me to wrap the whole main in a try.
>you cannot .unwrap() and not care
You should probably care about the thing you're building.
>>
>>107480115
>.unwrap() allows being haphazardous faggot.
So can an if
>>
>>107480230
>You should probably care about the thing you're building.
Tell that to Cloudflare reliability team that didn't make a plan for vetting configs being pushed to their global infrastructure lol
>>
>>107480272
Mistakes happen.
>>
>>107480330
But would Rust have prevented it?
>>
>>107480689
... No?
>>
>>107480272
Their plan was to rollback an update on failure. But their orchestrator failed to do so.
>>
>>107480230
>I hate how Java forced me to catch all exceptions.
you can just throw it further
>That just led me to wrap the whole main in a try.
you can throw from main() too
>>
What I don't get about the Cloudflare thing is wouldn't you push an update to a small pool of servers and make sure everything is fine before pushing it everywhere?
>>
>>107481167
Yes and it's not the first time Cloudflare did this.
>>
Yesterday I saw a little of Rust for the first time.

Macros vs functions is confusing as fuck
>>
>>107481167
Yes, it's called A/B testing.
A stands for Alpha, Beta stands for Beta, and cloudflare sees entire world as their Beta bitch, so they made us suffer an outage globally like the Alphas that they are.
>>
>>107481193
>the only language that makes macros explicit with different call syntax
>confusing
>>
>>107481238
No, this is called blue green deployment.
A/B testing is something different. It's when you create two or more versions of something and deploy them in parallel to see which one is more effective.
>>
>>107481193
Never used C or lisp?
>>
>>107481370
Is the blue royal?
>>
>>107481399
about 25 years ago
>>
What kind of game could a programmer make that lets them flex their programming skills? RTS? Something with complex AI behavioral paths?
>>
>>107481545
Games are art works, programming is secondary. If you want to flex your programming skills make impressive program or write a scientific paper on some new method or algorithm you have come up with.

>inb4 but I really want to make game
Make a CTF then.
>>
>>107481238
>still seething about that
It was just one day. I hardly even noticed.
>>
>>107481545
Yet another unfun TUI roguelikelitelitelite using only ASCII characters.
>>
>>107481193
>Macros vs functions is confusing as fuck
You don't need to worry about it yet. Just know that rust macros are better than c macros.
>>
>>107480983
>you can throw from main() too
Is that a modern thing? You couldn't when I was doing Java in ancient times. It refused to compile if I didn't at least catch all exceptions in publicstaticvoidmainstringargs.
>>
>>107481545
What programming skills do you need flexing?
>>
How much of a stupid idea is something like this
template<typename T>
class Defaultable
{
std::optional<T> data;
static T default;
T& get() { return data ? *data : default; }
};

class User
{
Defaultable<int> a;
Defaultable<char> b;
}
>>
>>107481976
Why not make something like Rust's Default using concepts?
>>
>>107456434
>What are you working on, /g/?
Optimising memory usage of my console.
>>
>>107482011
Not familiar with it, post usage example.
>>
>>107481750
oldest Java my Eclipse lets me use (without having to find an ancient JRE/JDK on my own) is 1.8

Copilot says
>In Java, you have always been able to declare throws on the main method — this has been part of the language since Java 1.0 in 1996.

it's not implicit though, you still have to declare the throws from main() (even if just as
public static void main(String[] args) throws Exception
)
>>
>>107482069
pub const trait Default: Sized {
fn default() -> Self;
}

It's basically C++'s DefaultConstructible. It means that a type can be constructed with no arguments, ie has some default value.
But the nice thing is that Option(which is Rust's std::optional) has method Option::<T>::unwrap_or_default(), which is yours Defaultable::get(). This is a better solution imo because it does not declare a new type which acts basically as value T except has an extra overhead of optional for basically no gain. Just use T or if you want to have T value, and extend std::optional<T> where T is DefaultConstructible with a method that can return the contained value or its default value if absent, if you need to reason about optional values. Also, your Defaultable might be confusing if you mutate that default value and suddenly all other empty instances get mutated. It might also be not thread safe in that case too.
>>
>>107482164
And by extend I mean use these friend shenanigans or however else you add methods to external types in C++. Do not create a new class that inherits from it. Unless that's how it is done in C++ idk I haven't used it in 10 years.
>>
>>107482164
>type can be constructed with no arguments
That's not what I'm trying to achieve. I need to store multiple configurations that fall back to global config if unset, both are read from files at runtime and can be modified.
>Option(which is Rust's std::optional) has method Option::<T>::unwrap_or_default()
std::optional has value_or(/*something*/) method, but it creates a copy, so it's suboptimal there
>>
>>107482232
Global state is bad, m'kay?
>>
>>107481976
very
>>
>>107482082
I might simply not have known that back then.
>>
What do I think about sml?
>>
>>107481976
You should just use clang-tidy and enable the cppcoreguidelines-pro-type-member-init, which will tell you to fix your shit, the following will generate an error:
class Test
{
public:
int a;
bool b;
};

int main(int, char **)
{
Test test;
return test.a;
}


<source>:10:5: warning: uninitialized record type: 'test' [cppcoreguidelines-pro-type-member-init


class Test
{
public:
int a = 0;
bool b = true;
};

int main(int, char **)
{
Test test;
return test.a;
}

But the following will not
>>
I've recently realized that the vast majority of formally educated programmers were taught wrong. Imperative programming, object oriented programming. These methods should not be what a novice programmer learns first. Functional programming, entity component system, these will are the way to go.
>>
>>107482667
>you should use static analyzer on what's basically glorified pseudocode used for illustrative purpose
no, I don't think I will
>>
Should I learn Erlang or Elixir? Is concurrency in BEAM really as good as they say? Also, can I learn Elixir without learning Erlang before it?
>>
>>107482705
Imperative and functional programming are two sides of the same coin. Students should be taught turing machines, lambda calculus and then how to prove that they are equivalent.
>>
>>107482746
It solves your problem without any overhead, though.
>>
>>107482805
Actually nevermind, I misunderstood the issue.
>>
>>107482760
>Should I learn Erlang or Elixir?
If you're asking this question the answer is yes.
>>
double (*g(float f(int)))(long);

In C this is apparently how you declare a function g that takes as argument "a pointer to a function f that takes an int and returns a float" and returns "a pointer to a function that takes a long and returns a double".
How the fuck does this syntax make sense?
>>
>>107482801
While I do agree with what you say about students should be taught, I disagree strongly that OOP and ECS are two sides of the same coin. OOP is a mistake.
>>
>>107482906
>How the fuck does this syntax make sense?
really dumb autistic idea that it should mimic the usage
>>
>>107482801
first functards need to write some software widely used in enterprises so people learning it can hope for a job, otherwise time wasted on FP is better spent on learning OOP or even procedural, since those are actually used in the industry

>>107483057
OOP and ECS operate on different levels of abstraction. you can have both in the same application
>>
>>107483186
I don't see how it does that.
>>
>>107482906
>>107483226
Imagine you're calling that function:
double result = (*g(f))(10L);

This also works, and arguable is preferred because functions pointers dereference to themselves i.e. (*g) == g
double result g(f)(10L);

But you need to consider the first form when defining a function.

Sure, it's ugly as fuck, and can take quite a while to manually parse, but there is some logic to how it works.
Very very rarely will you see anything unironically used in practice, and typedefs are almost always used to make it simpler visually.
>>
>>107483226
the fp argument yeah but its at least the type in one place
some_double = (*g(&some_int_to_float))(some_long);
>>
>>107483366
anything like that*
>>
>>107483366
>>107483369
I need to remember this way of thinking about it.
>>
>>107483366
>t.150 iq
>>
>150 iq
bc of the explanation
i dont give a shit i just let the compiler tell me what im supposed to do with these details
>hurrr durr void*
yeah
that means you tell the compiler
>its ok, bro, i got this

which is the opposite of prompting the compiler so it remembers 3/4 of the language so you dont have to

thence
150iq
bc what you said is not immediately apparent even when reading teh standard.
as far as i read it.
i write hacky shit so the standard doent really intervene much in my code
>>
>>107483187
You misunderstand my point, I'm saying OOP shouldn't be utilized. ECS is more true to the hardware.
>>
>>107483628
>I'm saying OOP shouldn't be utilized.
there are plenty of use cases of virtual tables
>>
>>107483770
name 20
>>
>>107483628
>I'm saying OOP shouldn't be utilized
bro lost this argument 50 years ago and is still holding on
>>
>>107483922
Next are you going to ask me what function pointers are for? How about switch statements?
>>
>>107483979
>how can a variable you can make into a function be usefulle?

its a longjump table but completely canonical
its insanely powerful
quite limited
but in some cases, incanely powerful
>>
>>107483628
>ECS is more true to the hardware.
and OOP is closer to whatever abstraction you're implementing
>'m saying OOP shouldn't be utilized
it just shouldn't be half-assed, or you'll get all the typical problems you blame "OOP" for
>>
>>107456434
Im working on v4l2 stuff with dmabuf directly mapping it to an opengl texture
>>
File: 1010223.jpg (932 KB, 1920x1080)
932 KB
932 KB JPG
>>107456434
I'm studying TCP/IP
>>
>>107483628
>ECS
>true to hardware
who gunna tell him
>>
>>107483979
What are function pointers for? How about switch statements?
>>
>>107485094
dynamic jump tables
libraries
programming languages
its really powerful stuff
>>
>>107485094
>>107485231 cont
>switches
theyre powerful on their own, but they serve a different purpose
similar, conceptually
but within the scope of a function
>>
File: ai-shills.png (72 KB, 860x740)
72 KB
72 KB PNG
btw btw
>>107484374
>pepper implies its a faggot
if thats a faggot why did you draw him as feminine as possible?
its a contradiciton in itself
why would one seek to fuck effeminate faggots when one could just fuck women?
this is entirely anthetical to the spirit of c
shits' supposed to be straightforward
>>
>>107485294
Not him but... Woman with a penis?
>>
>>107485346
theres nothing to censor in that zone if it was a woman thats been modeled
the fun zone is way below the models thighs in that case
>>
>>107485346
>>107485359 cont
unless angle grinder has been applied
i know you know what i allude to
>>
>>107475978
Assert is not for error handling, it is for verifying invariants, either to prevent catastrophic behavior or to catch programming errors during testing.

>>107477011
>>107478391
I agree that int or bool returns as status codes, or status codes mixed with values is bad design. The function should return a strongly typed enum describing the error. I don't really have a problem with checked exceptions other than the complexity they add to the language. I think Java got exceptions right with checked exceptions. My primary exposure to exceptions is in C++ and Python where they are only a source of headaches.

>you wouldn't want to see every every method either explicitly throw or catch
I would. I want to know what error states a function can generate and I want the compiler to check that I am handling them. Checked exceptions lose a lot of the ergonomics of unchecked exceptions, but people would argue the same wrt. dynamic typing, and my response is the same: I don't care, I would rather the code be verbose and the compiler constantly bitch at me than have opaque control flow on errors.

>you're just reinventing checked exceptions but mixing status/meta-control into the business logic
The appeal of errors as values is they don't require the language complexity that exceptions require. If you have stack unwinding you now need something like RAII, which requires constructor/destructor methods, or you'll have resource leaks. C++ has a lot of zero-cost-but-not-really abstractions specifically because of exceptions and the code required to handle them properly.

>>107478467
It should be required. Python people say something similar wrt. to type annotation and it annoys the fuck out of me. The language either guarantees it or it doesn't, if it's opt-in then I can't know whether any piece of code has it or not, and therefore whether it will behave as I expect, without either manually checking or running some external checker.
>>
>>107485956
First part meant for
>>107479289
>>
I need a math library like eigen to be able to use rust
>>
>>107485294
it is entirely in line with the spirit of c. The premise of c is to achieve 90% of the power of other hlls with 1/10th the implementation complexity. In other words, c is a budget pascal. In much the same way, the humble trap achieves 90% the sexiness of your typical woman while only requiring the maintenance of man. Hence you can just fuck them and dump them without having to worry about their feelings.
>>
>>107484213
>and OOP is closer to whatever abstraction you're implementing
Wrong, ECS is better for that too. OOP's flaws are inherent and that's why engines are shifting to ECS.
>>
>>107486549
you can't even name the "flaws"
at least not without exposing your own skill issue
>>
>>107486549
ECS is literally OOP but in a non-obvious way, shit performance included.
>>
File: rope.jpg (18 KB, 347x612)
18 KB
18 KB JPG
>>107486228
>implying you goon to men bc you have feelings for women
this, too, is antithetical to c
>>
>>107486648
>Virtual function calls
>>unpredictable branches
>>>shit performance
>>
>>107486986
>unsubstantiated buzzwords
as expected. thank you for your concession
>>
>>107481545
Anything by Zachtronics.
>>
File: 1749245287424774.jpg (884 KB, 2880x2160)
884 KB
884 KB JPG
>>107481545
the game is largely irrelevant, you make the engine yourself and optimize it for performance of a few gimmicks to do something no COTS engine can do. pic related
>>
I JUST WANTED TO MAKE A BOUNCING BALL AND IT TOOK ALL 2 HOURS.
FUCK YOU JAVASCRIPT I HATE YOU.
>>
#define $

It's free real estate
>>
>>107487119
If you don't understand what I say then this was never even an actual debate.
>>
>>107481545
Make an MGTA clone.
>>
>>107487594
I don't understand who wants to play a game that has 1 type of enemy, 1 type of spell, 1 type of anything.
>inb4 nooo, these 50 branches that are more expensive than a virtual call, beutifully implement differences!
ECS, not even once.
>>
>>107487880
Oh, you're just baiting me.
>>
>>107487912
Where's the bait?
ECS fags can never:
>post their games
>post benchmarks proving that ECS is the reason why their game is fast
>actually have me ignoring their ECS babble because the game runs smoothly and I don't care
absolutely 0 instances
>>
Usecase for memcmp?
>>
>>107487464
That doesn't sound bad at all. Everything takes more time than you'd think.
>>
>>107488505
None, custom implementation is always faster.
>>
>>107488505
Comparing memory.
>>
I was able to boot into qemu with uefi. I have a yellow square.
How do I build the kernel now?
>>
Thoughts on OCaml as a general purpose programming language? FP is cool but Haskell is too uncompromising to be useful
>>
>>107489399
A meme. Like all GC'd languages, the only value is personal syntax preference for a scripting language.
>>
>>107489399
>filtered by Haskell
>>
>>107489360
https://www.linuxfromscratch.org/
>>
>>107489360
A real 16-bit assembly bootloader is 512 bytes or less.
>>
>>107491163
16 bit is legacy. I'm already in 64 bit long mode.
>>107490993
That's linux. I want to write my own kernel. Linus has nothing on me. I'm going to blow his shitty kernel out of the water.
>>
>>107488505
int greater(uint8_t a, uint_t b) {
#define BYTES (sizeof(uint8_t)/sizeof(char))
return greater(memcmp(&a, &b, 1 * BYTES), 0);
}
>>
>>107491281
>#define BYTES (sizeof(uint8_t)/sizeof(char))
>>
>>107491601
Don't worry sirs, it's multiplied by 1 where it is used (because there is only 1 of them)
>>
I...kinda want that chair...
>>
>>107491712
Does the girl come with it?
>>
>>107491180
Oh, sorry. I thought you just wanted to build the Linux kernel. Well, you could do that as a warmup exercise I guess.
>>
What does it take for an interpred and GC'd language to properply support multi-threading exactly?
If you can create threads and have the other typical thread functions (join, wait, signal, etc..), if you have mutexes so you can safely share data, if the GC supports multiple threads (GC region per thread, stop all threads when garbage collecting), is that it? do you need anything else?
>>
>>107492929
and of course each thread runs its own interpreter
>>
>>107456632
Nice, any frameworks or engines? Libraries?
>>
Like it or not, int is the best error type there ever was and will ever be.
>>
>>107456434
What can I do to become a better programmer, i.e. optimize more so that my coding performs more accurately? LLMs are naturally horrifically terrible at teaching this. Are there any books or sites, something to help me improve my habits so I'm not cooking up bloated spaghetti code that needs dozens of gigabytes of RAM to function?
>>
>>107487943
Full ECS or ECS-first architecture:

>Cyberpunk 2077 (CDPR’s REDengine uses heavy data-oriented / ECS patterns for crowds and city streaming)
Forspoken (Luminous Engine went full SoA/ECS for its particle hell)
Unity DOTS stack:
>Squid Game: Unleashed (top 10 on Netflix games, 100% DOTS)
>Unity’s own “Mona DRONE” tech demo runs 100k+ fully simulated agents
>Every single new Unity multiplayer sample (Boss Room, Bitesize, etc.) is DOTS-only now
>Bevy engine games on Steam right now: Veloren (Minecraft-like, 100% Rust ECS), Fish Fight, Apex, etc.
>Roblox literally switched their entire backend to ECS in 2023 because OOP was choking
>Every single new idTech engine (Doom Eternal, upcoming idTech 8) is archetypal/ECS under the hood
>Unreal Engine 5’s MassEntity + Chaos physics = literally Epic’s official ECS framework they’re pushing for open-world titles
>Remedy’s Northlight engine (Alan Wake 2, Control) went full data-oriented/ECS for the millions of destructible objects
>>
>>107494331
>What can I do to become a better programmer
>mentions LLMs
you have brain damage, nothing can make you better
>>
>>107494408
Which one of yours by the way?
Those are all slop.
>>
>>107494419
Cope and when the one I'm working on comes out early next year, you'll know. Trust me, it's going to blow minds.
>>
>>107494429
Sure thing zoomer, explain why it won't run on 20 year old hardware if it's so optimized.
>>
>>107494408
>citing anything unreal related
you just proved his point to be desu
>>
>>107494457
It simulates literally hundreds of thousands of unscripted, independent AI agents simultaneously in massive battles.
>>
>>107494575
Games did this 20 years ago, how is yours different?
>>
>>107494585
Get out
>>
>>107494585
Actually, you know what, I'll humor you. Mine is different because it's both parallelized and entirely deterministic.
>>
>>107494613
So why can't it run on old hardware?
>>
>>107494629
Well, it can, actually.
>>
>>107494414
I'm sorry master, I was using them as a point of mockery, examples of monstrosities that are pure spaghetti code beyond salvation.



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