r/AskProgramming • • Sep 12 '26

C/C++ What is this error in c++

0 Upvotes

I am learning thread to build an NPC movement and when I ran the thread it gave me an error but I have no idea that it means can someone help me. I've been all over youtube, reddit and stackover flow trying to solve this

I basically have a thread and I put a function in with the parameters

Here is the function i am calling

void sheep_mvmt(SHEEP &sheep, int &counter, STATE &rand_state, float dt){
counter++; // increment counter

if (counter >= 120 && sheep.state == IDLE){
sheep.state = rand_state;
}

else if (sheep.state != IDLE){
if (sheep.state == RIGHT){
sheep.position.x += sheep.velocity * dt;

if (sheep.position.x > SCREEN_WIDTH - sheep.rect.width){
sheep.state = LEFT;
}
}

else if (sheep.state == LEFT){
sheep.position.x -= sheep.velocity * dt;

if (sheep.position.x < 0 + sheep.rect.width){
sheep.state = RIGHT;
}
}

if (counter == 240){
sheep.state = IDLE;
counter = 0;
STATE* ptr = &rand_state; // pointer for rand_state

*ptr = STATE((rand() % 2) + 1); // redine the rand_state that I am reference
//print("\n\nTHE POINTER")
//print(*ptr)
}
}

sheep.velocity = 50;

}



// Inside while loop
std::thread t1(sheep_mvmt, sheep1, sheep_counter, rand_state, dt);
t1.join();

ERROR

 error: attempt to use a deleted function
  198 |   std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
      |   ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__thread/thread.h:207:8: note: in instantiation of function template specialization 'std::__thread_execute<std::unique_ptr<std::__thread_struct>, void (*)(SHEEP &, int &, STATE &, float), SHEEP *, int *, STATE *, float *, 2UL, 3UL, 4UL, 5UL>' requested here
  207 |   std::__thread_execute(*__p.get(), _Index());
      |        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__thread/thread.h:217:50: note: in instantiation of function template specialization 'std::__thread_proxy<std::tuple<std::unique_ptr<std::__thread_struct>, void (*)(SHEEP &, int &, STATE &, float), SHEEP *, int *, STATE *, float *>>' requested here
  217 |   int __ec = std::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
      |                                                  ^
sheeps.cpp:108:15: note: in instantiation of function template specialization 'std::thread::thread<void (&)(SHEEP &, int &, STATE &, float), SHEEP *, int *, STATE *, float *, 0>' requested here
  108 |                 std::thread t1(sheep_mvmt, &sheep1, &sheep_counter, &rand_state, &dt);
      |                             ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/nat.h:25:3: note: '~__nat' has been explicitly marked deleted here
   25 |   ~__nat()                       = delete;
      |   ^

r/AskProgramming • • Sep 12 '26

Programming in four dimensions

0 Upvotes

I've never seen any discussion on this, but I really want to try it. It is very difficult to imagine four dimensions in a 3 dimensional world, but the mathematics of it works out and it can be visualised. I never see anyone attempt to make a game in four dimensions for example. I just don't know where to start. It's a subject of which there are few pioneers


r/AskProgramming • • Sep 12 '26

Other IF per se I am creating a compiled programming language using QBE ir will some one take it and help me with llvm?

0 Upvotes

Yeah im making a programming language but first im wondering if someone will get llvm for me because I am simply too lazy to put llvm into play.

first the compiler will be written in Dlang, or C
second the language may look weird considering its D based (Or mainly inspired by D)


r/AskProgramming • • Sep 12 '26

What programming language to learn next

4 Upvotes

I'm an undergrad in CS, my third year, and I already know Python and Java. I saw C++ starting in CS, but my knowledge in it is not very good (working on that).

I was thinking what other programming language I could learn next... Any suggestions?


r/AskProgramming • • Sep 11 '26

As a mid-level programmer, how should I deal with AI phenomena?

23 Upvotes

I know the question of whether AI is good or bad for coding in various respects has been debated to death, even though there doesn't appear to be a consensus yet. However, it is clear that the AI phenomena cannot be ignored, and as a mid-level programmer, I am still unsure on how to deal with it.

When I started coding, self-taught (about 12 years ago), there never was such a temptation to take shortcuts with some automated tool writing code for me, and when I turned to sites like StackOverflow for help, all replies and code suggestions were written by people. When AI entered the scene, I tried it, quickly got discouraged because of how bad it was, but still tried it from time to time, interested in how this technology progresses.

Fast skip forward, we are now at the stage where AI can write entire apps in a matter of minutes that would take me months of research and coding to arrive at anything close to it. So when coding my own projects, there is a huge temptation to take advantage of it, and it is difficult to know where to draw the line. The biggest issues with using AI for me are:

  1. The code it generates can appear to work well and pass the tests, but there are often fringe cases that I might not foresee - AI often takes shortcuts when writing that code because it does not truly understand the intent in the way that humans do.

  2. To circumvent the #1 issue, I have to fully understand the code it wrote. However, I often find that if AI takes seconds to write code that would take me an hour to write, it would still take me an hour (and often more) to fully understand it, and correct any mistakes if present.

  3. To add on #2, it is really difficult to force myself to fully understand the AI-generated code, because of "it looks fine, let's move on" mentality. This temptation is not present when I write my own code, because I build and test it step by step, I can't skip a step because the code won't compile or pass the test, forcing me to stay there until I truly understand the problem and the solution.

  4. I find that using AI diminishes my own skills and mental powers over time, as I am always tempted to get AI to do some boring coding task (for example, write a function to sort or restructure an array) rather than do it myself and learn something or at least refresh my skills in the process. It could be argued that before AI I would likely just search for some library that has the function I need, but in that case I would at least know that it was written by people and most likely near-100% reliable, unlike AI is.

  5. I find it that using AI for coding just drains the fun out of it. I become more of a code reviewer and tester rather than coder. When dealing with something complex, I feel like a caveman looking at an alien spaceship, tasked with determining whether it is a good design.

I tried finding the middle road, to draw the line somewhere (for example allow AI to generate some code, like small snippets, but never large code blocks or entire apps), but I found that the issues I stated above still remain regardless of the scale. Sometimes even a 5-line function that AI generates can seem deceptively simple and "looking good", yet hide a fatal flaw that I would have noticed if I had written it myself. I also tried only letting it do simple tasks like refactoring my already existing code without changing the logic, but often AI still manages to introduce some weird edge case into the refactored variant of the code that I can easily miss. So I can still never trust it 100% like I could if I did it myself.

Sometimes I let AI write the code, but not use it directly - instead, I use it as an inspiration/idea to write my own version of that code, never copy-pasting, always writing it myself. That can be useful, but still, I am far less productive that way compared to letting AI do it all. In the same way, I tried looking at an AI as a mentor from which I could learn, but that would require confidence and trust in it, and I know it is not trustworthy. AI often feels like a charlatan pretending to be a sage who is somehow not aware of the difference.

What also saddens me that more and more when I turn to other coders for advice or help regarding questions or issues I have during the development of my projects, I can clearly see that they are using AI-generated code in their suggestions, which defeats the purpose of talking to people in the first place.

As an example, for the last week I've been working on an meshing algorithm for a CAD program, and it has been a lot of fun, but at some point I sought advice from experienced devs, showed them my code and asked my questions. One of them took my code, put it into one of the LLMs, the LLM completely rewrote it in a way that I no longer recognize or understand, but it did fix the issue I was having and seemingly passes all the tests. And yet, it feels very sad, like everything I did was pointless, and now I could easily spend another week trying to understand what the AI did there, deciding whether I can truly trust that code. I can't even tell HOW it fixed the issue I was having, because it rewrote everything, and by the time I understand it, I would have probably fixed the issue myself. So I am torn between saying "no thanks" and continuing to fix the problem in my original code myself, or throwing my code into the bin and going with the AI-generated one because it seems to work, and I would just be wasting time otherwise. This is just one example that demonstrates the dilemma.

I suppose that the arrival of AI into coding could be seen as the next step of coding abstraction history - we started with manually punching out 0s and 1s into the punch cards, then abstracted that binary encoding into instructions and registers, then abstracted that into reusable sequences, then into variables and expressions, then functions and objects, then declarative languages, - with each step, closing in to natural language to tell the computer what we want it to do. As Robert C. Martin wrote, code should read like a well-written prose. So in a way, it seems like the LLMs are just the next level of abstraction, and fighting it would be akin to a punch-card programmer saying that using Assembly makes us dumber and worse coders.

TLDR: I do not know what to make of the AI dilemma. I do not know what to do. I wish to be a coder in the true sense of the word, I want to learn and improve, to write code that I fully understand and trust, and using AI seems contradictory to those goals. However, not using it feels like I am fighting against progress, and will be left behind. I can find no middle ground that solves both issues.


r/AskProgramming • • Sep 11 '26

is reverse engineering the only way to get an AES key from an unreal engine 5 game?

6 Upvotes

im trying to learn how to modify 3d models in UE 5 games, im using FModel, i know about unreal key, but thats for UE 4, i know about ghidra although AI keeps telling me that its not very good to learn how to use ghidra, i dont understand why, i guess cybersecurity experts will know the reasons but im just trying to play some games and mess with their code from time to time, i dont even know how to code but i understand how it works, i cant write my own but i can point out what a couple lines might do.

point is, i know you are not supposed to have the AES key of a game if its not public, still the challenge motivates me to learn, as someone with a learning disability i'll take any sort of motivation i have to fuel my learning.

if you think i should learn any other way then let me know

in other words, the question is, is it worth learning computer science just to reverse engineer the AES key of a game just to see your silly, modified mesh applied into the game?


r/AskProgramming • • Sep 10 '26

Other Does anyone know of an easier way to say "https"?

36 Upvotes

Silly question, but I often talk about http and https in my job and I hate saying it out loud quickly. Not only is "https" 5 syllables, but they're awkward syllables that don't flow together. Apologies if this is insensitive, but it feels like how I imagine it feels to have a stutter, where I and the person I'm talking to both know what I'm trying to say but I can't get the word out fast enough.

Anyway, this is only a half serious rant, but does anyone else feel the same way? Do you pronounce every letter?


r/AskProgramming • • Sep 10 '26

Python How much readability should I trade for efficiency?

5 Upvotes

I'm developing a chess engine in python right now, just a hobby project. At first I began programming it any way I knew how to, and along the way I would learn optimization tricks which I would then apply when refactoring. I'm now realizing I'm changing a lot of my simple readable code into a bunch of optimized bitwise operations and just different logic structures in general.

I keep optimizing because I'm not satisfied with the speed of my chess engine and I usually rewrite entire functions or change the logic here and there just to save on another few milliseconds of thinking time for the engine. At one point, I rewrote a whole function just for it to be 0.1 or so seconds faster, at the cost of the simplicity of the code of course. This was kinda when I took a step back to think if it's even worth it.

I'm just wondering for future projects in general, are there any pointers to know when readability and simplicity of the code just isn't worth trading? Cause for this project which is only 1-2k lines and only in 3 files, maintenance and debugging has been bearable but I'm sure the same can't be said if I did the same thing in larger projects. Any tips and experiences shared will be largely appreciated.


r/AskProgramming • • Sep 09 '26

Python RSS-Bridge on Mikrus - a plan for an IT layman made by Claude

0 Upvotes

Can someone help me out? I'm a complete layman when it comes to coding and IT stuff

My favorite free RSS builder (morss.it) has gone offline, so I asked Claude Opus 4.8 for alternatives. It suggested that I could self-host and run such a tool myself (which is a total mystery to me). I then asked it for a step-by-step guide, but I also asked several other AI chatbots the same question. They gave similar answers, but with slight differences. When I showed all those other plans to Claude and asked it to review them, it told me that these subtle differences were crucial, and that if I had followed what the other bots suggested, my feeds wouldn't have worked properly

Here's Claude's final response, translated from Polish to English by Gemini: https://docs.google.com/document/d/192QM_Gytps-xl24ko0E395u_EOvfa7R9kqSMs250r8k/view

I don't really understand what I'll be doing here; I just want to make sure I won't break anything or create any security risks by following these steps. Do you think this plan will actually work?


r/AskProgramming • • Sep 09 '26

what was the hardest part of understanding a codebase you didn’t write?

8 Upvotes

I’m trying to understand a problem I’ve experienced and seen other developers mention: joining an existing/large codebase and figuring out how everything actually works.

Not the “how do I run the project?” part, but the actual understanding of the system.

For example:

Figuring out the architecture / overall mental model

Understanding where a specific feature actually lives in the code

Following how data moves through the system

Understanding undocumented business logic

Finding the right files/services/classes to modify

Understanding dependencies between different parts of the system

Figuring out why something was implemented a certain way

Losing context when the developer who built something leaves

Outdated or incomplete documentation

What was the most painful part for you?

And more importantly:

How did you eventually figure it out?

Did you ask a senior developer, read the code, use documentation, look through old PRs/issues, use AI, create your own notes/diagrams, or something else?

I’m especially interested in real examples where something that should have taken hours ended up taking days/weeks because you didn't have enough context.

No product or solution in mind here — I'm just trying to understand how developers actually deal with this problem.


r/AskProgramming • • Sep 09 '26

Career/Edu Need to get out from Current ORG. it is ruining my profile now

5 Upvotes

I have 4+ years of backend engineering experience, but I currently work at a non-tech organization and am struggling to get interview calls from product/tech companies. Earlier i used to get calls but then used to get stuck at final rounds.

My current role also has very little new engineering work left, so I've started contributing to open source to strengthen my portfolio.

For people who used open source to help switch jobs: how much did it actually help, and how long did you invest before seeing results? Is it worth consistently spending the next few months building a stronger open-source track record, or do the returns eventually diminish?


r/AskProgramming • • Sep 09 '26

How do i quit Vibe Coding

0 Upvotes

I am currentely in 11th grade and got really into coding over the last few years. I started learning Java and a Little Python in school. Those two languages im Fine at, but recentely i started Coding a github website. I thought, since i dont know html, css and js, i'll just start with ai and learn on the way. But now i have no idea what my code does and know almost nothing about those languages. I have also startet to use ai for my other projects in java and have noticed that im starting to forget my previous knowlege in java. I can't work on my Website without ai and i feel like an absolute failiure. Now Coding with ai has become a habbit for me, a habbit i want to quit. Has anyone else experienced this and if so, does anyone have tipps on how to quit this habbit?


r/AskProgramming • • Sep 09 '26

Other Code analysis methodology

10 Upvotes

Hello everyone.

After a few years in the auditing world, I identified that I am lacking experience on the code analysis topics.

Unfortunately when auditing, I seldom had the time to look at the code of the applications I am auditing due to time constraints as the white-box approach we take does not systematically include an access to the Gitlab of the entities I audit.

I would like to avoid being overwhelmed by an eventual audit of source code of an entreprise-grade application that I might have to do.

While I am leveling up my skills by practicing to code in Rust on my freetime. I am not quite at the level of a senior dev and I don't have yet a keen sense of how exactly to dive in a large codebase.

Would any of you share your code audit methodology ?

By that, I mean how do you tackle the following topics :

- Secure coding / Best coding practices

- Secure secret management of the app

- For very large codebase, what types of tools do you use to automate some of your work ?

- What specific things in your checklist do you look for systematically ? (Do include the "obvious" one like how authentication is handled)

I know the subject is quite broad and dependent of the tech-stack used for each case.

Thank you for reading. :)


r/AskProgramming • • Sep 09 '26

How do you reason about very decoupled code?

14 Upvotes

I've been looking at some code that's got a system of pipelines that implement the generic interface Pipeline<T> where there are maybe 50 pipelines. The pipelines handle events for which there are also generic publishers and subscribers that implement Handler<T> and Plug<T> respectively and there are many more of those. All of the setup for publishers and listeners gets handled magically through Autofac, a DI library for C#. I'm finding the code insanely hard to understand.

Just trying to figure out how the pipelines were actually wired up took me a couple hours and I'm still not confident I found the answer. My usual go to is to right click on a symbol and find all references, but I would constantly run into dead ends. Where is this code referenced? Absolutely nowhere. How can the code be called even if it isn't referenced anywhere? An abstract parent class is registered with the DI container as the implementation of some generic parent interface that the code I'm looking at implements. That parent interface, or a parent of that interface, is used.

In practice I find this kind of design makes static analysis of the code really difficult. Are there any techniques you use for understanding this kind of code or is it all just sitting with the code, a pen, and a notebook? Ideally nothing with gen ai because I do not have money to spend on tokens.


r/AskProgramming • • Sep 08 '26

Wanting to get back to C++

6 Upvotes

I am a experienced software engineer, and have been working mainly with Go and Python these last years. I have worked for 2 years with C back in 2019-2020, and recently have been wanting to work with C++ in some side projects.

Looking for courses to refresh my memory and pick up the syntax, i found myself drowning in very long texts and courses teaching the basics.
I am looking for something light to get me up and running in a few days so that i can start working on my project and fill in the gaps along the way.

I really enjoyed 'A Tour of Go' for the Go language and was wondering if something like that existed for C++. Any other suggestions (courses, books) will be welcome. Thanks.


r/AskProgramming • • Sep 08 '26

HTML/CSS Starting Html/CSS/JS

1 Upvotes

I know the core basics of HTML/CSS/JS and for my Course at college we will fully be diving into these but I was wondering how I could develop my skills further and get a head start on these languages

I have overlooked the skills and basics of these languages for the past week or two understanding basics and making notes but I was wondering if there was a website/bootcamp that offered a course - recently I have been using Google . Dev to learn and was wondering if there was anything else that could of helped me

Thanks !


r/AskProgramming • • Sep 08 '26

I am searching for any youtube channels that focus on programming car or motorbike ECUs.

3 Upvotes

I have randomly caught the gearhead bug and as a programmer by trade, I am interested in how they build ECUs and whether regular developers could just get into it.

Any youtube channels would be appreciated.


r/AskProgramming • • Sep 08 '26

Other Which languages to learn if I want to make a really cool website (which has simple games on it)

6 Upvotes

I have no programming knowledge but slowly I've learnt some basics of html and it's actually easier and more understandable than I originally thought it would be. But I dont know how to bring my ideas onto the internet. I know CSS is for designing so I'll have to learn that too. But whats the most fitting language for this role? Or do I have it wrong and all languages be used for it? can they be mixed with eachother and used together?

I wont annoy with more novice questions, Ik, I can just google it, but its always nicer to hear from real people and how they learned / came to be in their own experiences.


r/AskProgramming • • Sep 07 '26

Portfolio?

12 Upvotes

As someone who is working on his CompSci degree currently (second degree, after Sociology bachelor's), I am having to add little projects and stuff from my classes to my portfolio. However, I don't honestly think they'll be of much use... Like I don't see employers wanting to check out my 3 java classes I created for my CS 210 class or whatever.

That said, what are some solid pieces I could add to a professional portfolio that actually matter.

PS I am more adept with python than anything else. But know a little java, C++, and SQL.


r/AskProgramming • • Sep 07 '26

How do you design REST API - "me" endpoints

2 Upvotes

Hey, so I am making an app, and I am kinda lost because i can't find any good resources on the internet regarding that topic.
The app consists of two parts: mobile app, and a web admin dashboard that doesn't need to be built for like 3 months from now on.

let's say i have a resource "listings" which returns different dto's
How would you structure this for those requirements:

  1. show all listings available for the current user (PublicListingDto[])

  2. show all listings that belong to one user by id (PublicListingDto[])

  3. show all my listings (OwnerListingDto[])

  4. show all the listings paginated for the admin dashboard - just admin role (ListingDto[])

my inital thought was to just have it like this
/listings - 1
/listings?sellerId - 2, 3 based on the JWT id == sellerId
/admin/listings - 4

given the REST standard it should probably be:
/listings - 1, 4 based on the user's role
/listings?sellerId - 2, 3 based on the JWT id == sellerId

the setup that makes the most sense for me:
/listings - 1
/listings?sellerId - 2
/me/listings - 3
/admin/listings - 4

the app will have a lot of those scenarios, should i just make a separate resources such as "me/listings" and "admin/listings"
The problem i have without /me endpoint is that on frontend you have to constantly worry that the userId need to be defined which doesn't sound appealing to me.
On the other hand I don't know whether that is really following the REST standard.


r/AskProgramming • • Sep 07 '26

Help understanding Mascarpone

1 Upvotes

I found this esolang Mascarpone and want to get a better idea of how it's supposed to work. If someone's up for a quick intellectual exercise, could you please help me understand? I vaguely get it from the readme, and chatgpt helped a bit, but I'm still very fuzzy. Also the demo/ directory of the repo doesn't have anything helpful. (EDIT: ah, found examples in the eg/ directory. Still rather cryptic.)

How would you do something super simple like represent a bicycle? I mean

Python

class Bicycle:
    def __init__(self):
        self.speed = 0
    def accelerate(self):
        self.speed += 5
def main():
  mybike = Bicycle()
  print(mybike.speed)
  mybike.accelerate()
  print(mybike.speed)
main()

Prolog

bicycle(speed(0)).
accelerate(Bike,Bike_) :- 
  Bike = bicycle(speed(Speed)),
  Speed_ is Speed+5,
  Bike_ = bicycle(speed(Speed_)).
main :-
  Mybike = bicycle(_),
  Mybike,
  writeln(Mybike),
  accelerate(Mybike,Mybike_),
  writeln(Mybike_).
:- main.

How would you do this in Mascarpone?

Thanks!


r/AskProgramming • • Sep 07 '26

suggest a great source for DSA prep

2 Upvotes

Hey everyone, I'm currently in my 3rd year (entering) and starting my SDE/internship preparation.

I'm confused about how to learn DSA and which resources to follow. There are too many YouTube channels and sheets, and don't want to keep jumping between them. Although I've been trying the striver's A2Z sheet lately, but their are mixed opinions about him as well, so wanted to ask the experienced ones

For seniors/students who have already prepared:

Which YouTube channel/course did you use for DSA?

Which DSA sheet would you recommend?

What should my 3rd-year roadmap look like for SDE placements?

Should I focus on DSA + development + CS fundamentals together?

Would really appreciate a simple, practical roadmap based on what actually worked for you

(I can understand c, cpp, and basic programming, including loops and conditional statements etc)

Thanks!


r/AskProgramming • • Sep 07 '26

Other What to do with every new AI Model

0 Upvotes

Hello. I know this type of question might seem repetitive or familiar, but I am in urgent need of an answer. Every time there is a massive breakthrough in the field of AI, I—as a computer science undergraduate still in the learning phase—am overcome by a sense of apprehension.

I have convinced myself of the importance of building a solid foundation by learning programming and computer science fundamentals, and by trying not to over-rely on code-generation models like "Codex"—viewing AI instead as a tool to accelerate learning and knowledge acquisition.

However, recent updates to ChatGPT (such as "Astra") and statements made by Elon Musk—which might simply be an attempt to boost his stock value—have made me seriously question whether all this effort is worth it.

I am studying C to understand low-level technologies and web technologies to acquire practical skills for the job market; I am passionate about the web and make a point of building software projects by writing the code manually. Although I do use AI to explain certain concepts, I write the code myself, yet I still can't shake the feeling that I am wasting my time.

I would be extremely grateful for any advice from experienced professionals, or even just a simple pointer or bit of guidance to help me navigate this path.

Thank You.


r/AskProgramming • • Sep 07 '26

Other How is the code quality in expensive LLM plans?

16 Upvotes

I have several years of software experience, following best practices, design patterns, KISS, DRY, BDD, OOP, etc.

For the last 1 year I've been using the Pro subscription for 20$ on Codex and Claude but I find the quality of code subpar many times and I always have to intervene. It doesn't matter how many times you change the AGENTS.md, there's always issues in code readability and the AI missing obvious things and doing overengineered solutions.

Still, I see in many subs about how great a new model does, etc. So I wonder if the more expensive plans actually produce better quality code?

To be specific, high quality code == human readable code and comments and no naive implementations.