Thread #108561805
HomeIndexCatalogAll ThreadsNew ThreadReply
H
What are you working on, /g/?

Previous: >>108540878
+Showing all 357 replies.
>>
i++
>>
>>108561847
i = i + 1
>>
pee pee = poo poo +penis.
>>
>>108561940
INC $FB
>>
File: file.png (60.7 KB)
60.7 KB
60.7 KB PNG
abandon c, use freepascal
>>
CPP = C Plus Power
>>
>>108562136
Sorry pisswolf, not interested.
>>
>>108561805
I'm learning discrete math since I heard it's used with programming. I have basic programming experience, and so far barely seeing any similarities outside of logic.

Are these stupid fucking digraphs important?
>>
manual coding is boomercoded
>>
Honest question, if I use claude code on a codebase that has a lot of slurs in the comments, will I get banned or will claude refuse to work with me? I'm considering showing claude my personal project which is quite large, and there are a lot of politically incorrect comments like for example "// workaround for gay Windows bug, fucking M$ diversity hire niggers..." and so on.
>>
>start a project
>something interesting comes up in the middle of it
>goto 10
>>
>>108561805
I’ve been messing around seeing if I enjoy coding. Now it’s time to make another project but I don’t even have any ideas that strongly attract me. I guess I’ll just make Snake or a Sudoku solver or something.
>>
>>108562379
I have a hard time just achieving the first part
>>
File: superc.png (496 KB)
496 KB
496 KB PNG
>>108562142
now I want to invent a new programming language
>>
I just want an ai that can teach me how to program real good not one that programs for me
>>
>>108562789
>teach me how
ngmi
>>
>>108562789
It's called a book. Read a book.
>>
>>108562789
dear diary
today frogposter was based again
also he's kind of cute
>>
#ifndef UNICODE
#define UNICODE
#endif

I mean, is the conditional really necessary?
>>
>>108563032
Safety first.
>>
>>108563032
you're supposed to place code between the defne and endif with the conditional only including that code once
>>
>>108563032
Header guards are a strange concept
>>
>>108563032
Maybe you already included some library that for some reason defined UNICODE as having some specific value and you don't want to just blindly redefine it? I would hope most library authors wouldn't be that retarded, but you never know.
>>
>>108562789
Just learn assembly.

>>108562756
Input sourcing is asking the question *where* your parameters are coming from - which becomes really important the moment you're dealing with NUL-terminated strings because the strings you're feeding to your functions may not be NUL-terminated at all. They may be part of other strings, part of read-only data, part of some network data (say, HTTP) ...

If you want to use such strings without out-of-band data (i.e. string length parameter) you have to do it in-band (i.e terminate them yourself).
To terminate them you first have to allocate memory (or have some scratch memory ready), copy the string from source to target (hope you're not evicting your caches), terminate the string, pass it to the function that only expects terminated strings, and then release the memory again (or keep it around for future use).

... whereas with out-of-band signalling all you need to do is have a pointer point to the data and tell the function how many bytes you want read.
>>
#include <winsdkver.h>
#define _WIN32_WINNT 0x0A00
#include <sdkddkver.h>

>VCR101: Macro can be converted to constexpr
It literally can't though. Is there a way to suppress these 1-off editor warnings in Visual Studio or do you just ignore the squiggly lines? I know you can globally suppress them with a pragma, but that sounds bad.
>>
>>108563229
if the warning doesn't show up when you compile then it's not a real warning
>>
>>108562136
actually BASED
>>
>>108563222
>Just learn assembly.
NTA, got any recs for learning resources? I'm tired of being a high level midwit.
>>
>>108563303
https://uops.info/table.html
https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions?view=msvc-170
https://agner.org/optimize/optimizing_assembly.pdf
Ghidra or IDA or both.
x64dbg.
>>
>>108563288
>>108563229
Yes but the VCR warnings are garbage. I get similar warnings when using gMock macros. The real issue is the 100s of fake warnings mask the few true warnings that you want to see.
>>
>>108561805
image search is completed but it's too powerful to make public or host publicly
>>
>>108562789
Mythos can do it but it's too powerful for you.
>>
>>108563303
Pick a function you're curious about, paste it in Godbolt and try to understand how the compiler optimizes it.
>>
>>108561805
How do you guys inspired yourself to code something?
At this point, I don't code, I just chatGPT it for my work 99% of the time. so like at this point I'm not even a "programmer" anymore. it's suck.
any books?
>>
>>108563222
>Input sourcing is asking the question *where* your parameters are coming from.
The only time I have ever had to deal with non-null terminated strings is when I am parsing strings.
But the thing is that the memory is usually already copied. If I use rapidjson, it has it's own stack buffer for everything. And it supports in-situ parsing (destroys the string), but printing errors is nice, and that's the main reason I don't destroy the string (but if it's a file, I can just read it again).
I don't trust hand parsing because rapidjson has embarrassed me with my own binary parser (I wrote a json/binary wrapper, but rapidjson was so fast, it made the binary parser pointless, my binary parser WAS faster and 1000x smaller, but not fast enough for me to be happy with, I might as well use flatbuffers or zpp::bits, AND I was using rapidjson in a very non-optimal way where every single variable would store it's location for rich debugging info, so it would have probably been even closer in performance if I just used it raw).
So if you use a library for parsing known formats, null termination isn't an issue, since all formats will give you null terminated strings for you (either on a stack, or in-situ).
>>
>>108563566
>But the thing is that the memory is usually already copied.
Cool, so let's just copy it *again*, because, y'know, cache invalidation and locality ain't real!

>rapidjson was so fast
Have you looked at *why*?
>>
>>108563525
ikr you're forced into AI, and if even if you try to get it to teach you or debug things for you it'll just write everything for you. Feels like the parallels that CAM manufacturing had back in the day.
>>
>>108563587
>*why*?
{"test":[0,1,2,3,4]}
was not that slow compared to
(error check) 4bytes (error check) 4 bytes (etc)
I'm not saying that my code was super slow, I think my code was at least 2-10x faster, but that's not acceptable when I wrote RJ to be SUPER SLOW. I don't even want to talk about how much time I wasted trying to make the error messages super pretty and accurate to match the exact line column of the file.
The whole parser was thrown out at the end because the API was too flimsy and not retard-proof enough. I can't store generic arrays of elements, I needed to set the size and do that weird IsReader/IsWriter logic so parsing is done in one function, but it's just not worth it (even if I split the function).
But I know that rapidjson will get 100x slower the second I start using more identifiers / objects instead of one big array. The binary parser would ignore identifiers (the identifier is just a sanity check for json).
>>
working on my chess website

based.mobi
>>
>>108563650
OH, I just remembered that rapidjson does not use null terminated strings, because I was not using the normal API (I need to use callbacks to get the errors in the correct location). If you used it normally you would get null terminated strings. And the normal API uses a hash lookup I think, like a normal json API (You can't actually modify the json files in an editor, it's basically binary with redundant sizes, I wanted to use it as a pretty way of printing the binary data).
But I could have implemented rapidjson as a pseudo binary format, just a big json array, and it would have been fine in terms of performance.
but there are better ways.
>>
>>108562109
>being able to directly increment a memory address
>>
>>108563834
http://6502.org/users/obelisk/6502/reference.html#INC
>>
>AI constantly going back and forth on whether or not CS_OWNDC is beneficial for a DX12 application
absolutely fucking useless slopbots
>>
>>108563407
Clicked the first link and don't know what the fuck I'm looking at
>>
>>108563867
DX12 uses DXGI, not GDI. You only need an HWND, not an HDC - and as such an independent DC is superfluous.

>>108563883
Instruction table telling you how many cycles certain instructions take on different CPUs. Makes you appreciate certain optimizations more (like using LEAs instead of MULs).
>>
>>108563932
>DX12 uses DXGI, not GDI. You only need an HWND, not an HDC - and as such an independent DC is superfluous.
yet google results is full of people saying it's still relevant in dx12 regardless of whether you're using gdi or not
>>
>>108563980
What's the rationale supposed to be? It only helps speeding up GetDC and ReleaseDC calls (by not doing anything). If you're that worried, hook these two functions, then see how many times they're actually called.
>>
boy, I sure am glad that we got rid of those hideous = signs in c++ and replaced them for more braces!
>>
>>108563525
Shiiiiiet, I dunno, like employment and shiet.
>>
>>108563834
I like my code beautiful. If you get out of ring 0, it's not beautiful anymore. Don't get greedy
https://www.youtube.com/watch?v=mWNd2EubXVk
>>
>trying to understand a project on github
>not sure where it's getting access to a function
>literally 14 layers deep header included into a header included into a header etc...
is this normal?
>>
>>108564424
Yes, 95% of all code is shit.
>>
>>108564424
If it's included then it's included. Why do you care where it's included? If you want to see the function you can just grep it or use your IDE's search features.
>>
>>108563525
How much do you *actually* know what's executed on the machine? What the actual processor instructions are?
>>
>>108563525
>inspired
Your thoughts might inspire you or spark interest. But the act of starting to code can only be done by pure force. You have to force yourself to do it. Doesn't matter if you want to or not.
If you don't force yourself, it's not happening. Joy comes from the act of doing it. Not from the thought of the act
>>
>>108563525
I like making things myself.
No point using LLMs to do what you like.
>>
File: bluray.jpg (31.4 KB)
31.4 KB
31.4 KB JPG
It's the same shit every fucking day.
> Start to kode happily
> Hit a not obvious bug
> Get lazy and spiral around
> Get annoyed by AI and search for the bug myself
> AI was on the wrong fucking path all the time.

last prooompt:
> I found the bug and it was really easy to solve. Very easy. The easiest bug. Tremendous bug. Great bug.
> Now it's your time to shine and prove me that AI ain't trash. Can you find the bug or can't you?
> Here is the original source with the bug still included. It's very easy to solve. Where is the bug?
> If you can find it, then i will like share and subscribe again. Otherwise I won't. Go.

>it still couldn't find the bug.
Unsubscribed and trashed. It just costs way too much time. Tfw fell for the Ads way too long
>>
>>108564876
    process(clk, rstn)
variable tmp_sio_out : std_logic_vector(7 downto 0);
variable idx_v : integer;
begin
if rstn = '0' then

elsif rising_edge(clk) then
ack <= '0';

case curr_state is
when ST_IDLE =>
sio_oe <= '0';
csn_i <= '1';
[...]
if req = '1' then
[...]
if we = '1' then
wdata_reg <= wdata;
cmd_data_reg <= SPI_QUAD_WRITE;
else
cmd_data_reg <= SPI_QUAD_READ;
end if;
curr_state <= ST_CMD;
end if;
when ST_CMD =>
csn_i <= '0';
sio_oe <= '1';
[...]
when ST_ADDR =>
[...]
if bit_cnt = 0 then
if we_reg = '1' then
bit_cnt <= 3;
sio_oe <= '1';
curr_state <= ST_WRITE;
else
bit_cnt <= RD_WAIT_CYCLES-1;
-- sio_oe <= '0'; WRONG!
curr_state <= ST_WAIT;
end if;
end if;
when ST_WAIT =>
sio_oe <= '0'; -- based
[...]
when ST_WRITE => [...]
when ST_READ =>
when ST_ACK => [...]
end case;
end if;
end process;


If anyone wants to know:
The sio_oe signal going low had to be moved from ST_ADDR to ST_WAIT such that the last addr nibble will still get output on the next clock cycle.
>>
why is it that I write a program that allocates no dynamic memory and just sits there doing nothing and if I watch it in task manager the memory usage continuously fluctuates up and down?
>>
>>108565865
>task manager
Your thread is not the only one doing stuff. There's like three or four threads for other shit that run parallel to yours.
>>
>>108565926
? I'm not talking system wide memory usage, task manager breaks it down by process
>>
>>108565940
Yes.
>>
>>108565865
My guesses would be
>runtime fuckery
>reserved memory being shuffled around
>>
>>108561805
I made an Iterator for Lists in MAIDS, to see if I could do it, but I am not sure it is actually useful, because everything I can do with the iterator, I can also do with recursion and I think the recursive code looks nicer and is easier to understand, and MAIDS has TCO anyways. I also wrote a random number generator in MAIDS which is nicer than the one from my last example and works for arbitrary ranges of integers passed to it as arguments.

I would upload a screenshot of the IDE to show the Iterator, but I appear to be currently blocked from uploading images? Hopefully that stops soon.
>>
>>108565865
What OS?
Are you using standard io, network or files?
>>
>>108565979
>What OS?
He said "task manager".
>>
>>108565999
My xfce DE comes with a task manager as well.
>>
finally added thumbnails to my filemanager
>>
>>108565999
>she thinks only one OS has a task manager
>>
>>108566337
Only one OS has tasks worth managing.
>>
>>108566311
uh???? Normal linux people need 20 years for that. I call fake
>>
>>108566346
Oh no! It's retarded.
>>
>>108565979
>What OS?
templeOS
>>
I wrote another design doc
This the second iteration of my doc for a napoleonic wars-themed RTS game
>actually write some code?
n-not yet
>>
>>108566963
You mean like, the Cossacks' series?
>>
>>108567006
God I hate GSC.
>Become a millionaire by selling games
>Donate money to the state to draft your former fans
Don't but anything from them.
>>
>>108567642
Nah, they're based. I would give them even more money if I didn't already own all their games.
>>
>>108563503
>Token seller! I am going to program and I want your strongest tokens!
> My tokens are too strong for you, prompter!
>>
I get what pointers are, but what are some actual use cases for them?
>>
>>108568080
To point at stuff.

I don't get why people are confused by pointers. It's just a list. Each list entry has a number
>>
>>108568080
>I get what pointers are
>what are some actual use cases for them?
If you get what they are, I don't understand why you'd be asking such a question.
Indirection. Lots and lots of indirection.
For reading or changing a value way over yonder.
To place all of your resources in one spot and only refer to it.
They're memory addresses.
>>
>>108568080
Virtual address space.
>>
Came across this codebase today.
If their abbreviated prefix wasn't sketchy enough,
I'm just loving their error codes!

https://github.com/kkos/oniguruma
https://github.com/kkos/oniguruma/blob/master/src/oniggnu.h
https://github.com/kkos/oniguruma/blob/master/src/regerror.c#L49
>>
I get what hormones are, but what are some actual use cases for them?
>>
>>108568298
To neuter yourself.
>>
>>108568080
confusing beginners
>>
>>108567776
Half of those suck.
>>
>>108568510
Not based on my time investments in the 2010s.
>fuck me I'm old
>>
>>108568446
>instead of containing a thing, the pointer contains the location of the thing
How is this confusing?
>>
>>108568519
why are you asking me
>>
why does goto exist when you can just make a loop or nested function
>>
>>108568080
>what are some actual use cases for pointers?
Talking about THAT THING RIGHT THERE, and not some other thing.
In theory, you could instead use indices into an array of them. That would work the same sort of way, if you sort of squint and and ignore a few details. (You can think of pointers as indices into a gigantic array the size of all your memory.)
If your language has references, they're pointers plus some pinky-swear promises around what operations you can do with them.
>>
>>108568641
The break and continue keywords are basically just gotos
>>
>>108568641
GOTO existed first. It's the primitive. It's what your CPU really understands. Loops are implemented with a goto.
>>
>>108568641
Targeted resource release.
>>
>>108568641
because breaking out of nested loops can be extremely retarded.
https://www.geeksforgeeks.org/go-language/go-goto-statement/

Usage is quite common in go
>>
>>108568668
>The break and continue keywords are basically just gotos
No. Not at all.
A colleague at cagie said the same.
But continue and break are syntactically well defined. It is 100% clear where you will jump then.
Goto relies on the human doing the right thing. Even tho both jump to a predefined position they are quite different to me, grammatically speaking
>>
>>108568719
>make a nested function
>return
>>
1.1 The Basic Principle

(...)

Keep it Simple

As the number of capabilities you add to a program increases, the complexity of the program increases exponentially. The problem of maintaining compatibility among these capabililties, to say nothing of some sort of internal consistency in the program, can easily get out of hand. You can avoid this if you apply the Basic Principle. You may be acquainted with an operating system that ignored the Basic Principle.

It is very hard to apply. All the pressures, internal and external, conspire to add features to your program. After all, it only takes a half-dozen instructions; so why not? The only opposing pressure is the Basic Principle, and if you ignore it, there is no opposing pressure.

(...)

The Basic Principle has a corollary:

Do Not Speculate!

Do not put code in your program that might be used. Do not leave hooks on which you can hang extensions. The things you might want to do are infinite; that means that each one has 0 probability of realization. If you need an extension later, you can code it later - and probably do a better job than if you did it now. And if someone else adds the extension, will they notice the hooks you left? Will you document that aspect of your program?

The Basic Principle has another corollary:

Do It Yourself!

Now we get down the the nitty-gritty. This is our first clash with the establishment. The conventional approach, enforced to a greater or lesser extent, is that you shall use a standard subroutine. I say that you should write your own subroutines.

(...)

But suppose everyone wrote their own subroutines? Isn't that a step backward; away from the millenium when our programs are machine independent, when we all write in the same language, maybe even on the same computer? Let me take a stand: I can't solve the problems of the world. With luck, I can write a good program.

Programming a Problem-Oriented Language
https://www.forth.org/POL.pdf
Chuck Moore, June 1970
>>
>>108568769
>Keep it Simple
Stopped reading there. KISS is autism speak that hasn't worked since 1982 at the very least, and everyone still advocating for it deserves nothing less but the cage.
>>
>>108568749
>muh klean kode
kys and you're unreadable shitkode
>>
>>108568641
Goto is a branch that can take you anywhere.
>>
>>108568560
I guess I just don't understand the meme that pointers are difficult or confusing? Is this actually something people have difficulty with?
>>
>>108568641
There are some edge cases where avoiding goto makes a mess for no real reason and not all languages have continue, ways to leave outer loops or need to manually clean up a mess.
<<Restart>>
if System_Call = -1 then
if errno = EINTR then -- Interrupt, not a real error
goto Restart;
end if;
-- Actual errors here
end if;
>>
>>108568806
Don't get all poetic on us, sensitive guy.
>>
I stand with Goto-san
>>
>>108568816
In the real case, it can be done as
int ret;

while ((ret = syscall(...)) == -1 && errno == EINTR);

// Less tersely
do {
ret = syscall(...);
} while (ret == -1 && errno == EINTR);

if (ret == -1) {
// do something with errno
return;
}

But yes this still can get messy and goto can lead to much easier to reason about code, e.g. you jump back even further rather than just this 1 syscall.
>>
>>108568896
https://hackage-content.haskell.org/package/mtl-2.3.2/docs/Control-Monad-Cont.html#v:label
>>
>>108568896
Name's Break. Break Continue.
I'll have a soda on the rocks.
>>
>>108569026
Yeah, it's always possible to avoid it, but sometimes it's way more readable not to.
It's just peak reddit to make an unreadable mess just because retards start convulsing and screeching "muh Dijkstra".

Knuth wrote a decent amount on it and gave a whole lot of algorithmic examples.
>>
>>108561805
>What are you working on, /g/?
https://gitgud.io/ZekeRedgrave/ZEKETK/-/blob/master/UnixOS/Main.C?ref_type=heads

Working on Basic Mouse Event Function
>>
I don't want to sleep, but i think i am too tired for koding :(
>>
class MyClass {
public:
MyClass(const std::string &a) : a(a) {}
MyClass(std::string &&a) : a(std::move(a)) {}

const std::string a;
};


am I really expected to do this shit just to copy a string? isn't it going to be kind of cancer if I have 2 or more strings as I'll need to make 2^n permutations of constructors to handle all cases?
>>
Started doing AoC 2020, just because. I feel like I'm too bad at theese kind of problems and I never do leetcode. Is it true they get unbelievably hard after like day 10?
>>
>>108569169
this is like 10 lines of code in swiftUI
>>
>>108569569
What?
>>
>>108569454
You can just use (std::string a), but technically speaking, it is not the same assembly generated(due to the destructor), but it's very likely your constructor will be inlined with optimizations so it doesn't matter, and the overhead is like a few nanoseconds (just comparing if the pointer is valid).
see around 20 minutes (unique_ptr isn't that much different than std::string)
https://www.youtube.com/watch?v=rHIkrotSwcc
>>
>>108569588
you could've coded that in 10 minutes using react
>>
>>108569617
>Make GUI program
>Using React
>Look inside
>Just web browser with bloated.js libraries
Bruh.... You can make your UI Toolkit in C from scratch and only cost less ram usage
>>
>>108569643
>I spent 3 days coding a UI from scratch in C because it uses 1mb of ram instead of the 2mb react would've used
>>
>>108569648
Okie
>>
>>108569169
>>108569569
char state[3];
FILE *mouse = fopen("/dev/input/mice", "r");
fread(state, 1, 3, mouse);
>>
>try to ask ai for help
>it just agrees with everything I say even when it's wrong
>>
>>108569805
Is that a possible?
>>
waow
>>
>>108569946
problem #101 - apply for a job
>>
>>108569888
Seg faults for me
>>
COPILOT TAKE THE WHEEL
>>
repo maintainer is asking us to switch to migrate to another library because the new one is "maintained" and the old one is not.
The library we're using has worked without issue for at least 5 years and hasn't been patched in 4 years. The new library has been getting commits daily. As in the new library is unstable and broken. This is what managers consider "alive" and "healthy", I'd rather stick with the dead thing that didn't move at all and just worked.
>>
>>108570000
N-NOOOOO MY STREAK NOOOOOO
>>
It's insane that Microsoft just announced that they're starting over fresh for Windows 13. No more legacy baggage. Written from the ground up in Rust and Typescript.
>>
>>108570034
I don't believe you
>>
>>108570034
m-muh dos headers
>>
>>108570034
No problem
Please continue destroying windows
>>
>>108569888
checked
it only works with root or the input group
>>
i hate liberries
>>
>>108570034
>autist just focuses on implementation, not interface
Opinion discarded with prejudice, DNR.
>>
>>108570485
They said it's going to be a "modern interface to reflect the changing face of programming".
>>
>>108570496
I need a source on that. There's no way they're doing to replace the NTAPI.
>>
>>108570485
do you know how easy it is for copilot to translate a program from the old api to the new one? the days of worrying about that stuff are long gone, boomer
>>
>>108570516
>do you know how easy it is for copilot to translate a program from the old api to the new one?
Yeah, right - because suddenly being able to use directly handles totally doesn't change the entire way userspace handles file paths and memory allocations.
>this is what vibe coders actually believe
>>
>>108570532
>directly
Directory*, ffs. Directory handles. Or, even better example, a batch of open and read and map and close requests.
>>
>>108569648
jeet mindset
>>
>>108570516
>for copilot to translate a program from the old api to the new one?
Is the new API in its training set?
>>
>not even 100 lines of code to get dx12 initialized and ready to start rendering 2d graphics
huh
>>
>>108570995
Do you have to allocate DMA staging buffers and copy your data into it manually? If not I'm not interested.
>>
>>108570995
Not a bad thing.
>>
>>108568080
you probably come from a language which does pass-by-reference for objects by default, i.e. you are used to being able to write code like this:
void ChangeFoo(Foo foo)
{
foo.bar = 4;
}

Foo myfoo;
myfoo.bar = 3;
ChangeFoo(foo);
//myfoo.bar is now 4


but in many low level language function arguments are pass-by-copy that means the above code would not actually change myfoo.bar's value (foo would be its own unique copy that gets initialized upon the function call & deinitialized afterwards). Pointers (& references) are the language construct that enables you do get that "referencing" behavior again. That is their usecase.
>>
>>108569454
i think you are looking for something called perfect forwarding here:
class MyClass
{
public:
template <typename T>
MyClass(T&& str) : a(std::forward<T>(str)) {}

const std::string a;
};

std::string str{"this string is copied"};
MyClass foo{str};
MyClass bar{ std::string{"this string is moved"} };
>>
>>108569454
>>108571672
class MyClass {
public:
MyClass(std::string a) : a(std::move(a)) {}

std::string a;
};
>>
>>108571681
this creates a copy in the constructor before it moves
>>
> Computers are small networks of interconnected devices on asynchronous networks that communicate with each other at their own time and pace. That's how they work. Every single computer has different devices talking to each other from different clocks. These clocks are not synchronized. Even if they had an error of one part per million. That's a bit per second per megahertz. We have way more than that actually going on.
t. Dan Kaminski

THINK ABOUT IT!!! IT'S CRAZY!!!
I'll post this on facebook too to spread awareness
>>
noooooooooooooooooooooooo.

>Want to build self-hosted computer
>Try to settle for existing stuff first (neorv32 risc-v cpu)
>It's too fucking complex. It's good, but too professional
>Have already 2 working not pipelined risc-v CPUs
>Now God tells me to work on my last risc-v cpu with classic 5 stage pipeline that killed me a few weeks ago because of some bugs
o-o-okay mr. god. I'll do it. Just for you.
>>
Realistically, how puritanical should I be about OOP?
Do I need to divide every function into its own class and get perverted with inheritance and interfaces?
>>
>>108571792
>Do I need to divide every function into its own class and get perverted with inheritance and interfaces?
Yes. Otherwise you will be executed by Linus
>>
>>108571792
>Realistically, how puritanical should I be about OOP?
structure of your logic? yes. if you half-ass it, you'll get all the typical issues with "OOP" most people complain about
coding practices? not that much

>Do I need to divide every function into its own class and get perverted with inheritance and interfaces?
no, just keep relevant things in their own scopes
>>
>>108571792
https://web.archive.org/web/http://number-none.com/blow/john_carmack_on_inlined_code.html
>>
What do you do when you have too much kode and turd on your compter?
You know exactly which project you want to work on but all the kode keeps your head spinning and overthinking.
I just want to delete everything to work on that project.
I should find a way to keep my computer clean so that I can focus on one project at a time
>>
uhhhhhhhhhhhhhhhhhhhhhhhh
is it really as easy to crash windows as the msdn says it is?
>>
>>108571742
Now that's what I call Holly Autism!
>>
>>108571862
>all the typical issues
Could you give a few examples for a newbie?
>>
>>108572061
Yes, but it's not fun. I wish i could just vibe code an AI app in javascript.
I am a little on the fence. I found this other guy that apparently did vibe code a bit and had a similar goal like me.
He did just copy the bare minimum neorv32 libs into his project
https://gitlab.com/gatemate/pc/software/dos/-/blob/main/include/soc/neorv32.h

Maybe i should do that too. Tho the autism says it's bad to go the same route someone else already went down, but on some days i should maybe just keep myself sane. So lets try this.
Tho this guy didn't write his own fucking compiler. I will. God and terry will smile down at me, if I can pull this off and make it self-hosted
>>
>>108571792
I shove as much shit into each class as I can until I need to reuse code
>customwebview
>customwebview.expansionbutton
>customwebview.zoomcontrols
>customwebview.savetoPDF()
>customwebview.createdirectory()
---figure out at this point that im going to have to reuse some of this shit---
>move expansionbutton and zoomcontrols to "webpagedisplayutilities"
>move createdirectory() to "localsystemfilemanagerutility"
>>
File: meirl.jpg (8.5 KB)
8.5 KB
8.5 KB JPG
>>108572135
>getUser
>getUser2
>getUserById
>getUserByName
>getUserByName2
>getUserNameById
>>
>>108571792
You're ngmi if your code has any static calls
>>
>>108572155
>Car car = new Car()
>>
>>108572155
Can't you just get all those at once and then use whichever you need at the moment?
>>
>>108572172
Class, object = new (instance of the ) class.
>>
>>108571962
Those docs probably haven't been updated since windows 3.1.
>>
>>108572374
But DXGI was added in like... Vista?
>>
>working on a toy language
>trying to figure out a nice syntax
>keep rediscovering lisp
I will NOT have s-exp!
>>
>>108572432
>>working on a toy language
>>trying to figure out a nice syntax
that's like saying you're designing a new car and you're trying to figure out a nice color
literal bikeshedding
>>
>>108572432
Have you tried alcohol? It might temporarily cure your autism.
>>
>>108572463
>literal bikeshedding
Well, yeah? The whole project is all about farting around and conjuring problems.
>>108572466
That would be cheating, I don't want to become too productive.
>>
>>108561940
Damn. Only AI could have coded that.
>>
>>108572070
if you go out of your way to avoid OOP in an OOP language, you'll end up with just a bunch of procedural code with extra syntactical overhead (ie. "why do I have to put everything in a class?! I just want some functions"). the trick is to design your program logic around objects and not just use procedural solutions with "OOP" syntax shoehorned over it

also don't fall for the "you must use a plaintext editor and compile from terminal" trap; you're not going to get better at programming by doing things the extra tedious and error-prone way. an IDE makes a lot of actions effortless and it's a tool you will eventually have to use anyway, so you might as well get used to it early
typical counter-argument: "hurr but then you don't know how the code really works" - especially a newbie doesn't need to bother with that, given the first programs will be just simple exercises. it's fine if it just compiles and runs within the IDE. it's much better to start with full focus on writing actual program logic, and look into compilation details only when it becomes relevant
>>
i = ordered_array_containing_all_known_integers[i + 1]
>>
>>108572488
>That would be cheating
OK, and? Alcohol has been humanity's best friend for thousands of years.
>>
>>108572514
That was a legit optimization back in the day for stuff like square roots. Probably not so much these days since you could take a hundred square roots in the time wasted on a cache miss.
>>
>>108572497
>why do I have to put everything in a class?
Ah, this is familiar...
>>
>>108572497
practically speaking there would be no real "overhead" just shoving your entire program in a class named program
>>
>>108572514
AND NOW IT'S INSTALLING LINUX? YOU BASTARD!
>>
>i++
terrible, useless, clutter
>i += 1
perfect, simple, allows users to control the increments, also implies the existence of other useful methods (-=, %=, *=, /=)
>>
>>108572497
>also don't fall for the "you must use a plaintext editor and compile from terminal" trap;
what retarded rabbithole have you been going down?
>>
move rax, 1
inc rax
>>
>>108572616
bro, you gotta check that shit for overflow bro
you gotta set it up to throw an exception just in case bro
bro your embedded assembly just tripped my antivirus
>>
>>108572624
>bro your embedded assembly just tripped my antivirus
Every program I've ever written in MASM and FASM, no matter how benign, has caused Windows Defender to go fucking apeshit. I don't know how it knows.
>>
procedure Increment(I: in out Integer)
with Global => null,
Depends => (I => I),
Pre => I < Integer'Last,
Post => I > I'Old
is
begin
I := @ + 1;
end Increment;
>>
>>108572616
>move rax, 1
Yikes.
>>
>>108572524
Wrong. I have no frens
>>
public class CounterService {

private int counter;

public CounterService(int initialValue) {
this.counter = initialValue;
}

public synchronized void incrementCounter() {
this.counter = this.counter + 1;
}

public int getCounter() {
return this.counter;
}
}

CounterService counterService = new CounterService(0);
counterService.incrementCounter();
int i = counterService.getCounter();
>>
>>108572699
saar... its beautiful code...
>>
>>108572586
>OOP is so dumb. I'm a functional bro all the way. No need to couple data and the methods that operate on it behind an interface using a pre-defined compile time hierarchy.
>object.Map()
>object.Filter()
>object.Reduce()
>object.ToString()
>>
>>108572739
bro you don't understand. It's not an object, it's a data structure!!!!
>>
>>108572739
in most oop I've seen classes just end up becoming dumping grounds for functions that operate on uncoupled data
>>
>>108572739
map/filter/reduce is a functional style programming. All these are higher order functions.
>>
>>108572699
>
public synchronized

please stop.
>>
how can i easily identify that an epub is erotic novel?
i dont want to run llm on 1 million epubs.
>>
>>108572739
queries
.grouped {
[$0[2], $0[0] % $0[2]]
}
.mapValues {
$0.map { ($0[0] / $0[2], $0[0] / $0[2] + ($0[1] - $0[0]) / $0[2], $0[3]) }
}
.reduce(into: nums) { [mod = 1000000007] (nums: inout [Int], element: (key: [Int], value: [(l: Int, r: Int, v: Int)])) in
element
.value
.reduce(into: Array(repeating: 1, count: nums.count / element.key[0] + 1)) { (products: inout [Int], query: (l: Int, r: Int, v: Int)) in
zip(
[query.l, query.r + 1],
[query.v, String(mod - 2, radix: 2).reduce(1) { $0 * $0 % mod * ($1 == "1" ? query.v : 1) % mod }]
)
.filter {
$0.0 < products.endIndex
}
.forEach {
products[$0] = products[$0] * $1 % mod
}
}
.reductions { $0 * $1 % mod }
.enumerated()
.map {
($0 * element.key[0] + element.key[1], $1)
}
.filter {
$0.0 < nums.endIndex
}
.forEach {
nums[$0] = nums[$0] * $1 % mod
}
}
.reduce(0, ^)

this melt's the proceduralfag's brain
>>
>>108572699
Pffhaha.
>>
>>108572901
It has Harry Potter or Vampire somewhere.
>>
>>108572901
check if it's written by a woman
>>
>>108572695
You would if you drank.

>>108572739
Reminder that compilers are too dumb to evaluate the state of an object at compile time and are much better at optimizing function parameters.
>doesn't mean they're perfect

>>108572901
>erotic novel
Just stop.
>>
>>108572607
Why not both?
>>
I am slowly putting together the routines to cache and write back blocks to the PS2 memory card that should make writing and updating data on the card more robust, I think.
But I'll have to refactor/strip out a lot of the old code soon.
>>
>>108573156
>You would if you drank.
akshually true.
When I got drunk regularly I still had "frens". Now I don't drink and they are gone.
I don't know what conclusion to draw from this, but i hate AI nevertheless
>>
>depressed because no Job
>too depressed to apply for Jobs (or even search through all those retard plattforms)
tfw no good feel
i'll just stop thinking about getting a job and code more. coding makes me happy
>>
>>108572613
it's called 'being employed'
>>
>>108573367
Sounds awful.
>>
>>108573321
Can't you do unskilled labour just to feel better?
>>
>>108573156
i want to delete all the erotic novels, thats why im asking.
>>
>>108573506
I'm unskilled at programming so I already am doing unskilled labour
>>
>>108573526
Try also stocking shelves.
>>
>>108573531
100 million illegals in the us doing that for pennies on the dollar under the table
>>
>>108573546
Try going to the south. There's more niggers tipping over the shelves than hands that can restock them.
>>
>>108572265
Over-fetching information is an issue in big services. You don't want to get the email and birthday of every user in the subscription feed of your Twitter or w/e. You just want the names and avatars.
>>
I like com objects, they're comfy and easy to use
>>
>>108573582
actually, the modern issue is opposite: too many round-going requests collecting data because it's all fragmented
>>
>>108572817
not really OOP, then
>>
>>108573684
They're a mess memory-management-wise.
>>
>>108573684
cfags HATE them
>>
>>108573506
I was considering sorting shelves at ALDI or something.
It might even be a good idea. But maybe the pain is not big enough yet to do it
>>
x86-64 COM Objects for Dummies
>>
>>108573810
This is my Bible... the gangbang scene feels a bit out of place tho...
>>
>>108573810
>>
>>108573582
But it probably would not cost ya anything?
>>
inb4 muh optimization
>>
I'm not sure what thread would be appropriate for this but I'll ask here: has anyone here integrated AI agents into games? If you have, in what ways?
>>
>>108574148
What problem are you trying to solve.
>>
>>108574230
Not anything specific. I am just looking into possibilities how I could leverage them while gaming and asking if anyone is already doing something like that. If I should name one particular use case, It would be nice if I could use an agent to translate games on the fly.
>>
>>108574259
>has anyone ever used this particular kind of hammer?
>what do you need to hammer?
>nothing specific, I am just looking into possibilities
???
>>
>>108574148
A lot of cheaters probably have.
>>
>>108571684
it will create a copy of a temporary (and I explained why it's not an issue in the other post), but if the value is an rvalue (it uses &&), it will construct the temporary using move semantics, and then you move the temporary into the member value (and the temporary gets destroyed).
I think it might be possible for the temp destructor to be completely optimized away, because I did not open this up in godbolt to check it out (if you look at the video I posted, the reason why the destructor needs to be checked is because it's needed to check for a bug related to not knowing if the funciton will move the value or not, but if it's all inlined, even if the constructor was forced to be non-inlined defined in a DLL or TU, it might still inline it, but of course if you constructed the rvalue outside the constructor and explicitly std::moved it in, that empty shell will probably have a pointless destructor call because it can't tell if the constructor moved the object or not).
And generally, I don't think people should care about the destructor of temporaries, the destructor could potentially catch bugs, and it's in the range of a few dozen nanoseconds at most (as I already explained).
The reason (std::string a) is good, is because unlike (const std::string& a), it will not make a copy for const char* conversions (aka, string literals, technically you can add a ""s suffix so that std::string&& works), const & strings will absolutely allocate memory (BUT in many cases, it wont due to inlining, or small string optimization, but it's very easy for functions to not be inlined so we should avoid const & strings).
Also I believe std::forward is identical to std::move, std::forward is mainly for when you have a const or volatile variable, because then you NEED to create (const std::string&&) and (volatile std::string&&) (both) but this isn't an issue, a const std::string&& is just a copy. And I believe it could make a temp destructor (but templates are usually inlined).
>>
>>108574452
Why would you use an AI agent for a cheat?
>>
>>108574612
>the destructor could potentially catch bugs
*nevermind, I was wrong, the destructor is 100% pointless. it wont catch anything. But I still don't think it matters enough until you actually have a situation where the temp destructor actually has a measurable overhead.
>>
>>108574631
I don't know, I'm not a cheater. I know that there are now AI cheats that can be used with any games.
>>
>>108574612
>Also I believe std::forward is identical to std::move
std::move unconditionally casts to an rvalue, std::forward<T> casts to an rvalue if T is an rvalue, so std::move is like std::forward<T&&>
(i think, maybe not, dunno)
>>108574694
probably depends what you're doing
>>
hmm, in theory this CPU is good, but for hacking around and stuff it's just too professional.
I tried again but it's just too much effort.
Also I got triggered by their comment now.
Why would you make that header 86 characters long?
It makes no sense. There is enough space to get it down to 80. What the fuck man. Time to use something else
>>
>>108575126
Yes, you are right, also I was wrong about const && working with lvalues, it's only for overloading binding order stuff for rvalues.
I think it's possible (std::string a) is optimized away due to copy elision (even with forcing inlining off), but I don't know.
But I can't really make any assumptions about if there are any temporary copies being made with redundant destructors, until it's tested in godbolt.
>>
>>108575610
it will depend on the compiler and the situation i'm guessing, MSVC often misses stuff
>>
>>108573300
That's because of social inhibition. Alcohol helps you open yourself up - it's also why most casual sex happens while being drunk.
>>
>>108564424
it's easier if you clone it first then use your editors go-to-definition feature
>>
>>108572172
In C# this is just
>var car = new Car()
>>
>>108561940
["i::\"" add(i, "1") "\";"];
>>
Maid posters are worse than autists.

By an inch.
>>
>>108576491
I think they cute.
>>
>>108576546
I think not.
>>
so you guys discuss stds here
will you look at this rash i have
of should i try v
>>
why do people who use AI only ever generate weblangs and python? where is all of the C/C++ code?
>>
>>108577215
It gives the AI the ick.
>>
>>108577215
I use LLMs for C++ all the time
>>
>>108574612
you've definitely got a wrong understanding of move semantics & rvalues but pointing it out exactly where & how you are wrong in all that text is too time consuming for me (it seems like you've built up a big intuition on your own based on assembly output). I just wanted to let you know. Go lookup how perfect forwarding works & why it is needed. The biggest thing to know with move semantics is that there is no such thing as a rvalue type - rvalue is a category. So for example this statement
>but if the value is an rvalue (it uses &&)
is wrong
>>
>>108577330
just to further illustrate:
void foo(std::string&& x);

x is not an rvalue or an rvalue reference is is an lvalue
>>
>>108577340
just make your own fat pointer string and you'll never have to deal with this crap again
>>
I think C++ might be worse than model trains for autistic poeple
>>
>>108577409
Yes, it's like genders. Permutations and all.
>>
>>108577409
every time i see made up fake pronouns it makes me think of that pic with like 15 different ways to declare a variable in C++
>>
>>108577215
People who write C or C++ code tend to want it to be correct. Only madmen rely on AI producing correct code.
>>
>>108577698
Segmentation fault (core dumped)
>>
>>108576443
let succ n f x = f (n f x)
one f x = f x
in
succ one
>>
>>108577917

must be smart maids 1911 seem quite difficult
>>
    char a = 0xff;
unsigned char b = 0xff;
printf("%d == %d = %d\n", a, b, a == b);

I expected a == b to be true since they're the same in binary
>>
>>108578122
implicit conversion rules. b = 255, a = -1, you then perform a comparison and both values get cast to an int and then compared. if you wanted to compare the representation rather than the value then you need to ensure they both use the same representation first (both signed or both unsigned). so (unsigned char)a == b or since you care about the raw value, and then you should have used %u in the string format to match the representation to print
>>
>>108568080
dynamic libraries
>>
>>108578122
I get different results
char a = 0xff;
unsigned char b = 0xff;
printf("%x\n%x\n%x\n", a, b, a == b);

ff
ff
1

signed char a = 0xff;
unsigned char b = 0xff;
printf("%x\n%x\n%x\n", a, b, a == b);

ffffffff
ff
0

arm32 wants to do sign extension real bad
>>
>>108577917
succ(*x)::
[*x "::\"" add({*x}, "1") "\";"];
>>
>>108578583
Sign extensions have been a pain for me on the PS2 as well.
Sometimes they are handy, but more often they're unexpected.
But a char is supposed to be just one byte, right? Even if the registers sign extend, why would it return a 32bit result?
>>
maybe if I chug like 500mg of caffeine tonight I can lock in for 10 hours straight and code a minimum viable prototype I can use for my application
>>
>>108578634
I've enjoyed your ps2 posts, the signed keyword is likely responsible altho signed a = 0xff is also ff on this architecture
>>
>>108578720

mouse computer staff dances at outdoor better wait three more hours before off from mattress
>>
fmap (+1)
>>
>>108578726
>>108578726
Just thought about it a bit, chars are probably stored as words for arithmetic purposes and the values clamped to 0-255 or -128-127.
>>
>>108578957
>not succ
+1job
>>
Hack the planet +1
>>
hebrew should be the official language of programming, all language keywords should be changed to hebrew and compilers should restrict identifiers to the hebrew character set
>>
File: save.webm (3.5 MB)
3.5 MB
3.5 MB WEBM
Of course, it's not working on hardware.
>>
>>108579434
Holocaust +1
>>
>>108579524
It's probably better that I focus on the rewriting before hardware compatibility.
There's a good chance that whatever I do to fix it now either won't survive the rewrite or something else will need fixing afterward.
>>
chatgpt and grok are so dumb i think i get stupider by asking them questions its like google searching something and then just believing the first result
>>
>>108579801
Don't talk about Google that way.
>>
I am so locked in right now
>>
>>108579985
alright yeah i love gooning too
>>
>>108577215
They don't even manage that. Y'all heard that story about that faggot app that was allegedly vibe-coded, and then it turned out he had to hire an actual programmer?
>and to top it off they used AWS
>because no one knows how to write scaling code anymore

I so hope the Strait will remain closed forever. We need that energy crunch so fucking bad.
>>
File: python.jpg (21 KB)
21 KB
21 KB JPG
>>108561805
>What are you working on, /g/?
Learning Ada 2022 (tm) rn.

>3.1.3 Function calls
> An important feature of function calls in Ada is that the return value at a call cannot be
ignored; that is, a function call cannot be used as a statement.
> If you want to call a function and do not need its result, you will still need to explicitly store
it in a local variable.

Wow, I fucking love Ada now. Why are you're languages not as based as Ada?
Afk getting some shasta
>>
>>108580324
saar...
>>
I am so dumb.
I should not be allowed near a computer, let alone writing code that will run on one.
>>
>>108580326
Let's take it back!
https://www.youtube.com/watch?v=pZa9BLJmziQ
>>
>>108580324
>11.1 Decimal fixed-point types
Holy mother of god. How fucking based can a language be?
God bless the holy DoD (uh, I mean DoW).
Damn. I fucking love Ada now
>>
>>108579801
Using AI was your first mistake.
>>
Not using AI was your last mistake.
>>
Using AI might have been a mistake. But it's not entirely clear
>>
> What are you working on, /g/?
I finally get decent level of intuition how to structure heavily monadic Bevy code (with many layers of Option/Results that depend on previous Option/Results). Rust actually makes this comfy. There's even limited monadic syntax with ? operator for fns returning Option, but also just general presence of very well though out methods like "inspect" that clearly communicates attaching side effect to unchanging value is really cute.
>>
>>108580475
Finish Setup

Sounds based, but vscode is triggering me. Sorry
>>
>>108580528
Picrel
>>108580410
Not using AI is never a mistake, it's actually a benefit.
>>
>>108580475
Does it generate good SIMD code?
>>
Why don't you fucking troll cretins go to /vcg/ to fester with eachother? /dpt/ is for actual programmers.
>>
>>108580547
They want validation from people who're more competent than they are. Very similar to women with daddy issues.
>>
someone tell the tripfag to go away
>>
>>108580581
Go away.
>>
>>108580581
You are an invasive species. Why don't you practice what you preach, queer?
>>
>>108580536
https://chatgpt.com/share/69da02a3-facc-8328-a0ad-021705c83f25
I'm far from optimizing stuff at that level. And before that I will need to do some basic things like ensure proper instancing everywhere possible and buffered shader uniforms. Godot would probably be enough for me if they had component composition based model and Blender-first approach where all components are configured on Blender side, like I do with Skein here. So yeah, my biggest reasons to use Bevy is Skein and the fact that BGE is unusable since Blender 4.
>>
>>108580612
>not looking at the actual code
>>
how did boomers program before ai?
>>
>>108580679
They just used their fucking brains you troglodyte fucking idiot. You are so intellectually neutered to the point that you don't see how retarded questions like these are.
>>
>tripfag vs aibabies
>>
File: ai.png (198.2 KB)
198.2 KB
198.2 KB PNG
Any good books on AI?
>>
>>108580731
who cares? you're a boomer. Your brain is calcified. Zoomers don't read books. We don't need them, we have the internet. Even if there were any good books, you wouldn't be able to use any of the information within them. You either find the info online or you're useless.
>>
#include <stdio.h>

int main() {
long long z = 15422255267402L;
do { fputc((((z&0xf)+0x3)^0x4)+0x5e, stdout);
} while(z>>=0x4);
fputc(0xA, stdout);
}

it's for you, anons
>>
>>108580749
no thanks my bike doesn't need any gas
>>
>>108580735
>We don't need them
>>
>>108580731
You don't need that, dumbass. You need actual books on actual coding. Plus, this is not /vcg/. Why the fuck are you so retarded?
>>
>>108580762
Become LITERALLY the first generation where IQ is declining. That's an achievement in itself desu
>>
>>108580775
>heh, we flooded the country with brown people and now your generation is mentally retarded
>clearly this is a reflection on the white youth and not the change in demographics we brought about in order to secure the future of our taco tuesdays
>>
>>108580533
https://i.4cdn.org/wsg/1775897688000825.webm" target="_blank">https://i.4cdn.org/wsg/1775897688000825.webm
>>
>>108580775
They're also proud of it.
>>
>>108580392
>God bless the holy DoD (uh, I mean DoW).
Still the DoD until Congress changes the name.
>>
>>108580780
Yeah, try to use your racism as excuse for not needing to learn anything.
Clearly you are too stupid to understand how IQ is defined and why the curve has to be adjusted every now and then
>>
Coolio. Trying to build a simple risc-v assembler with Ada now. I think I get the project flow now.

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

package body Tokenizer is
function TokenizeLine(Line: String) return Vector is
TokensOut: Vector := Empty_Vector;
Token : Unbounded_String;
begin
for I in Line'Range loop
if (Line(I) = ' ') or (Line(I) = ',') then
if Length(Token) > 0 then
TokensOut.Append(To_String(Token));
Token := Null_Unbounded_String;
end if;
else
Token := Token & Line(I);
end if;
end loop;
-- append last token
if Length(Token) > 0 then
TokensOut.Append(To_String(Token));
Token := Null_Unbounded_String;
end if;

return TokensOut;
end TokenizeLine;
end Tokenizer;

with Ada.Text_IO; use Ada.Text_IO;

with Tokenizer;
use Tokenizer;
use Tokenizer.String_Vectors;

procedure Hasm is
S : constant String := "addi x1, x1, 5";

tokens : Vector := Empty_Vector;
begin
Put_Line("Hello, World!");

tokens := Tokenizer.TokenizeLine(S);
for t of tokens loop
Put_Line("token: " & t);
end loop;
end Hasm;


> ./hasm
> Hello, World!
> token: addi
> token: x1
> token: x1
> token: 5
>>
>>108581015
PS: Yes, you saw that right. I have to cast Unbounded_String to a String. :^)
Feels good
>>
One of the fun cool things I have now from working with the PS2 memory card communications is a way to wipe the super block in a memory card, allowing it to be formatted again by the PS2 (which wipes all the data).
>>
I am having nightly meltdowns trying to figure out obscure OOP shit and how to make structs and classes communicate with each other in SwiftUI
holy fuck, is any of this even worth it?
>all views are structs instead of classes, apparently this has a massive performance boost and prevents memory leaks
>but you still need classes to manage the data for the views
>this leads to a bunch of problems, because now you need to make variables publishable or whatever the fuck and have observers to tell the app when to rebuild all of the view structs
>the fun part is when you have multiple classes being passed around views to try and coordinate all app changes

My current challenge:
- Have a bar at the top of my app (it contains a search bar, back button, settings, etc).
- Depending on which view you're in, the layout changes
- Trying to communicate the correct layout back to the topbar when you're like 7 views deep in the hierarchy is a nightmare

https://developer.apple.com/documentation/swiftui/stateobject
>>
>>108580735
>Zoomers don't read books. We don't need them, we have the internet.
I unironically think this
>>
>>108581020
Based, but
>I have to cast Unbounded_String to a String.
To_String is just a function in the Strings.Unbounded package and will allocate stack memory for the conversion.
Casting in Ada is done with Unchecked_Conversion or overlays.
>>
why did nobody tell me earlier that ai can program for you
>>
>>108581274
Not our fault you haven't paid any attention to the Internet for the past year.
(But why would you want it to? Are you going to ask someone else to fuck your wife?)
>>
>>108581274
>>108580295
>>
>>108580761
#include <stdio.h>
int main() {
unsigned long long jq = 13131343217747L;
do { fputc((((jq&0xf)+0x1)^0x2)+0x65,stdout);
} while(jq>>=0x4);
fputc(0xA,stdout);
}

anon, it's for you, again.... anon... they said it must happen again and you are the chosen one. take your time but don't be late, anon
>>
>>108580475
use Haskell
>>
.align 32
;; seconds, minutes, hours, day, month, year
rtc_cache:
dc8 0, 0, 0, 0, 0, 0, 0, 0
.align 32
RTC_get:
addi $sp, $sp, -56
sd $ra, 0($sp)
sd $s0, 8($sp)
sd $s1, 16($sp)
sd $s2, 24($sp)
sd $s3, 32($sp)
sd $s4, 40($sp)
sd $s5, 48($sp)
jal CDVD_wait
ori $s1, $zero, 0xEE ; get all time values
li $s0, CDVD_STATP
sb $s1, ($s0)
li $s0, CDVD_SCMD
ori $s1, $zero, 0x08
jal CDVD_wait
sb $s1, ($s0) ; send command and wait
li $s0, CDVD_RESULT
li $s2, rtc_cache
ori $s4, $zero, 0x08
RTC_get_loop:
lbu $s1, ($s0)
ori $s3, $zero, 0x04
beq $s3, $s4, RTC_get_loop
addi $s4, $s4, -1
andi $s3, $s1, 0x07
andi $s1, $s1, 0x70
srl $s1, $s1, 1 ; multiplied by 8
srl $s5, $s1, 2 ; multiplied by 2
add $s1, $s1, $s5
add $s1, $s1, $s3
sb $s1, ($s2)
bne $s4, $zero, RTC_get_loop
addi $s2, $s2, 1
;; the year is two digit, so let's add 2000 to it
lh $s1, -1($s2)
addi $s1, $s1, 2000
sh $s1, -1($s2)
ld $ra, 0($sp)
ld $s0, 8($sp)
ld $s1, 16($sp)
ld $s2, 24($sp)
ld $s3, 32($sp)
ld $s4, 40($sp)
ld $s5, 48($sp)
jr $ra
addi $sp, $sp, 56
CDVD_wait:
addi $sp, $sp, -16
sd $s0, 0($sp)
sd $s1, 8($sp)
li $s0, CDVD_STATP
CDVD_wait_loop:
lbu $s1, ($s0)
andi $s1, $s1, 0x80 ; busy if top bit set
bne $s1, $zero, CDVD_wait_loop
nop
ld $s0, 0($sp)
ld $s1, 8($sp)
jr $ra
addi $sp, $sp, 16

Getting RTC time and converting from BCD into format used in memory card.
>>
>>108581589
Honestly, I should probably be checking for the data available bit after waiting, but worse that happens is I get garbage out.
What may actually be prudent is a form of timeout in the wait loop like I have when reading the controller.
>>
>>108581168
Interesting. Thx.
>>
>>108574452
Yeah I suppose that is one obvious use case for it. I was more of thinking how I could make the AI agent into a conversational partner while I am gaming. I said my one use case would be translating but ultimately I was thinking of what are the the ways I could hook an agent into games. So I was wondering have anyone else here though the same and if they have, in what ways have the utilized them? Maybe in the future games could expose some clear APIs that agents can use. Or do they already?
>>
>>108581556
I'm already using Haskell, in my heart.
>>
>>108581754
>I already use Haskell in my imaginary life
top kek. Classic Maidposter
>>
>>108581754
you're supposed to use it in your code retard
>>
my code got complex enough to where the simplest solution was to make a custom stack class and give it a bunch of methods
all of those hours grinding leetcode are return dividends
>>
>>108581801
That's not how Haskell works.
>>
>>108581887
Haskell isn't work it's for NEETs
>>
>>108580612
>at that level
what the fuck is this supposed to mean, it's the basic primitive you should understand
why even bother with rust if you dont give a fuck
>>
>>108582084
I give a fuck downto stackalloc vs heap level, but not further than that, at least in foreseeable future. The first thing I will be optimizing is instancing and passing data to shaders. That's already a lot of work. And in terms of SIMD, most of it lives in dependencies of physics libraries I believe. So I use rapier3d, and it uses nalgebra, and that's where SIMD math is.
>>
>yeah bro arrays and pointers are the same in C
okay, explain this
#include <stdio.h>

int main() {
int array[10];
int* pointer = array;
printf("sizeof(array) = %d\nsizeof(pointer) = %d\n", sizeof(array), sizeof(pointer));
return 0;
}


the output of this when compile and run is
sizeof(array) = 40
sizeof(pointer) = 8

someone explain to my dumb brain what's happening here? why does sizeof work differently for arrays and pointers?
>>
>>108582228
https://www.reddit.com/r/rust/comments/y023fu/comment/irrgsnl/
^ old blogpost with some simd-powered lib benchmarks, nalgebra might be one of the best
>>
>>108582270
> yeah bro arrays and pointers are the same in C
Yeah, they're not. Your array is equivalent of struct with 10 int fields in this case. It will most likely be stack allocated btw.
>>
>>108582228
>I give a fuck downto stackalloc vs heap level
Even that is much more complicated that just stack vs heap. There's zero-copy growth, grouping, ordering ...
>>
>>108582318
That's a bit higher level than stack vs heap, so it's included.
>>
>>108582270
Remove the sizeof and see them print the same value.
>>
>>108582299
>Your array is equivalent of struct with 10 int fields in this case
Is that what the compiler is doing under the hood?
So you're telling me when I do
int a[10];

It gets allocated on the stack, but when I do
int* a = (int*) malloc(sizeof(int) * 10);

It gets allocated on the heap, correct?
>>108582383
That was my point, I thought arrays and pointers are the same but apparently for things like sizeof they are treated differently
>>
>>108582270
>pointer is 64bit = 8 bytes
>array is 10 32bit numbers = 40 bytes
It works differently because C knows that you are asking the size of an array in the first one and the size of the pointer in the second one.
>>
>>108582299
sometimes they are the same ;)
>>108582270
also, young anon, check out this cool way to pass params between function calls
#include <stdio.h>

void f(int a[], char *id) {
size_t s = sizeof(a);
}

void p() {
int *a; char *id; size_t s;
printf("f::sizeof(%s) = %d\n", id, s);
}

int main() {
int arr1[8], *arr2 = arr1;

f(arr1, "arr1");
p("arr1");

f(arr2, "arr2");
p("arr2");

return 0;
}
>>
>>108582465
sorry, forgot to remove params from p
#include <stdio.h>

void f(int a[], char *id) {
size_t s = sizeof(a);
}

void p() {
int *a; char *id; size_t s;
printf("f::sizeof(%s) = %d\n", id, s);
}

int main() {
int arr1[8], *arr2 = arr1;

f(arr1, "arr1");
p();

f(arr2, "arr2");
p();

return 0;
}
>>
>>108580731
NEAT only works for toy sized networks.
>>
>>108582270
>>yeah bro arrays and pointers are the same in C
anyone who tells you that is a brainlet retard that has no clue.
People just pass array as pointers to functions and then oh boy, it suddenly behaves like a pointer. CRAZY!!!
>>
>>108582496
when you use erlang it becomes infinitely scalable
>>
>>108561805
Next thread:
>>108582544
>>108582544
>>108582544
>>
>>108582419
>It gets allocated on the stack, but when I do
> It gets allocated on the heap, correct?
More like, in second case it's guaranteed to be allocated on heap, but in first case it might be allocated on stack, might end up completely in registers alone, or somewhere else. It seems C standard says that it is guaranteed to never allocate that on heap, but it never says it will allocate on stack, but in practice there's usually no other choices other than stack and registers on most architectures, and registers will only fit small arrays.
>>
>>108582270
arrays "decay" to pointers
when in the scope of their declaration, a compiler can tell a bit more information about an array, as evidenced by the sizeof results. but the instant you leave that scope (e.g., by addressing or dereferencing it, by casting it, by passing it to a function, etc.) the array will "decay" into a pointer and become indistinguishable from one
>>
>>108582270
>2026
>C is still confusing peoples with its garbage syntax
Overloading * was the mistake of the century.

Reply to Thread #108561805


Supported: JPG, PNG, GIF, WebP, WebM, MP4, MP3 (max 4MB)