Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
more falafel please
Feb 26, 2005

forums poster

Games are extremely big, with lots of stuff that doesn't have anything to do with math or rendering. You don't need strong math chops to work in games (can't hurt, though).

Source: 18-year veteran who is pretty sure I might know what a dot product does, maybe

Adbot
ADBOT LOVES YOU

Strong Sauce
Jul 2, 2003

You know I am not really your father.





I was thinking alone the lines of Game Engine developers and the like. Maybe they don't get paid that well. I would assume any hedge funds using C++ have probably worse coding standards than Enterprise apps. But I have nothing to go on for that thinking.

Also, if I told you what company I worked at you'd probably say I work in the Games industry. I just don't do anything that involves rendering a triangle onto the screen.

Okay that's it for me. Didn't want to derail this thread too much.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Strong Sauce posted:

I was thinking alone the lines of Game Engine developers and the like. Maybe they don't get paid that well. I would assume any hedge funds using C++ have probably worse coding standards than Enterprise apps. But I have nothing to go on for that thinking.

Also, if I told you what company I worked at you'd probably say I work in the Games industry. I just don't do anything that involves rendering a triangle onto the screen.

Okay that's it for me. Didn't want to derail this thread too much.

engine devs dont need math for the most part either.

throwing triangles at the screen is such a small part of games, if it werent for the very real visibility of it in the product id say it doesnt even matter. for most teams that part of the thing is a solved problem by epic or unity anyway.

very few people writing commercial renderers. fewer need to and should be.

games is about managing state with hard (soft) performance limits. typically state on a single node [even for most multiplayer games]. and copious amounts of UI, sometimes about that state but often instead about other state.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Larger and more established hedge funds will have better software development practices, or at least will be in the process of improving. A lot of the code they write is throwaway so that tends to be messier but the reusable components will generally have some sort of reasonable standards.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

my friends in finance tell me that their C++ codebases are a nightmare of header-only template metaprogramming that only the Russian programmers at the company can understand

if nothing else that sounds like a particular flavour of fun

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Some of that's what you need to do to get the performance, and some of it's the consequence of leaving newly minted math PhDs unsupervised.

OddObserver
Apr 3, 2009

ultrafilter posted:

Some of that's what you need to do to get the performance, and some of it's the consequence of leaving newly minted math PhDs unsupervised.

...this sounds like a comment on the STL, except I guess the newly minted part (and maybe the performance part).

PittTheElder
Feb 13, 2012

:geno: Yes, it's like a lava lamp.

Strong Sauce posted:

Thanks everyone for your sympathetic words. I kinda avoided this thread today because I was pretty exhausted from dealing with C++ at work that I wrote that out of frustration and didn't want to deal with anything C++ today.

I do feel like I'm a bit too old to be putting so much more esoteric knowledge into my brain. I'm stalling a bit in my career right now and I honestly don't know if trying to become an expert on C++ is the thing that reinvigorates my enjoyment of programming or of my job. There are probably lucrative jobs to be had with this skillset but I do not have the mathematical chops to do game programming, and I can't imagine Enterprise C++ apps are any better than Enterprise Java apps.

I guess it also doesn't help that we're basically supporting multiple platforms off the bat, and dealing with all the issues between each system, and that we're also reducing the team in half because we're having to reallocate resources.

I'll look into this.. maybe get my employer to buy these books.

Just get a job doing embedded systems development with a company like mine who still uses C++99, we don't have to deal with any of that poo poo :v:

Xarn
Jun 26, 2015
Still doing C++98 sounds miserable. I am generally angry about some things in the newer standards (goddamn import std.compat being superset of import std), but they are still a massive improvement.

more falafel please
Feb 26, 2005

forums poster

Xarn posted:

Still doing C++98 sounds miserable. I am generally angry about some things in the newer standards (goddamn import std.compat being superset of import std), but they are still a massive improvement.

I had to install VS2008 recently to do an eval of a C++03 codebase and it's dire. Remember faking static asserts with negative array indices?

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

more falafel please posted:

I had to install VS2008 recently to do an eval of a C++03 codebase and it's dire. Remember faking static asserts with negative array indices?

I used to do that with enums and division by 0.

His Divine Shadow
Aug 7, 2000

I'm not a fascist. I'm a priest. Fascists dress up in black and tell people what to do.
Reading a few pages back about CS and universities and I realize I will never ever be able to do any of that, it all sounds dreadfully boring. I'm also too old. I only do some programming stuff because it's interesting, but the higher education scene sounds like aliens talking about concepts beyond my feeble brain.

His Divine Shadow fucked around with this message at 08:15 on Mar 15, 2024

giogadi
Oct 27, 2009

His Divine Shadow posted:

Reading a few pages back about CS and universities and I realize I will never ever be able to do any of that, it all sounds dreadfully boring. I'm also too old. I only do some programming stuff because it's interesting, but the higher education scene sounds like aliens talking about concepts beyond my feeble brain.

What kind of programming do you like to do?

icantfindaname
Jul 1, 2008


I'm trying to write mods/change code in nethack, I have built it successfully on ubuntu, but what is the process of rebuilding it after I have edited the source code? Just do make install again?

https://github.com/NetHack/NetHack

more falafel please
Feb 26, 2005

forums poster

icantfindaname posted:

I'm trying to write mods/change code in nethack, I have built it successfully on ubuntu, but what is the process of rebuilding it after I have edited the source code? Just do make install again?

https://github.com/NetHack/NetHack

Typically running make will build the binaries, while make install will copy those binaries to an install directory like /usr/local/bin.

edit:
make install will also build the binaries, but typically you do those separately because make install is typically run with elevated privileges.

icantfindaname
Jul 1, 2008


So it will just replace the existing binaries in /usr/local/bin?

nielsm
Jun 1, 2009



Usually you can configure where it will install to, in some way. If the package comes with a 'configure' script that typically has an option for that, and otherwise it will be a variable in a Makefile.

more falafel please
Feb 26, 2005

forums poster

icantfindaname posted:

So it will just replace the existing binaries in /usr/local/bin?

nielsm posted:

Usually you can configure where it will install to, in some way. If the package comes with a 'configure' script that typically has an option for that, and otherwise it will be a variable in a Makefile.

This, but if you're iterating on these changes (making a change, testing it, making another change, testing it) there's no reason you have to do make install. The binaries will be built somewhere in the source directory (probably in the same directory as the makefile, but every project is different) and you can just run it from there.

icantfindaname
Jul 1, 2008


Alright, thanks

Ihmemies
Oct 6, 2012

Is there some way of disabling clang diagnostic completely for a project in VSCode?

I have some broken, bad code examples in .c files and the errors generated by clang are extremely annoying.

E: apparently this magic in .vscode/settings.json works and shuts up the editor:

JSON code:
{
    "C_Cpp.codeAnalysis.runAutomatically": false,
    "C_Cpp.files.exclude": {
        "**/.vscode": true,
        "**/.vs": true,
        "**/*.c": true,
    },
    "C_Cpp.errorSquiggles": "disabled",
}

Ihmemies fucked around with this message at 13:45 on Mar 17, 2024

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Why not just exclude the directory they’re in? I assume you haven’t intermingled intentionally bad sample code with, like, your primary source files.

Ihmemies
Oct 6, 2012

rjmccall posted:

Why not just exclude the directory they’re in? I assume you haven’t intermingled intentionally bad sample code with, like, your primary source files.

It is a LaTeX project and I am not very good at figuring out how to exclude stuff. I was embedding a few bad memory management examples to my work, but clangd cheerfully wanted to complain how many errors my .c files have…

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Why would clang see files in a LaTeX project?

Ihmemies
Oct 6, 2012

ultrafilter posted:

Why would clang see files in a LaTeX project?

I don’t know an answer to that either. The project is pulled from our university’s gitlab repository, which contains a LaTeX project for thesis work. I am not very good at this, I just didn’t want to fight with Word to produce a thesis in the style university requires. As a bonus Git is easy to use, especially if you write one sentence per one line..

The simplest solution to the problem was separating content from style, and that is what LaTeX is for. Anyways with that project-specific settings.json I get no more errors from the .c files.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Alright, if there are no actual source files in your project, excluding all C warnings is reasonable enough.

Ihmemies
Oct 6, 2012

rjmccall posted:

Alright, if there are no actual source files in your project, excluding all C warnings is reasonable enough.

Well they are actual .c source files, with proper syntax. But due to space reasons it does not make sense to include complete source files with includes and headers, so the .c files contain only the essential code.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

If the purpose of those source files is to be included as code listings in your LaTeX document there might be benefit in leaving those source files whole and slicing out only the relevant parts you need. That way, your code listings are always known to compile or otherwise be testable as your project develops.

The simplest but most brittle approach is to specify the relevant lines that you want in your document using linerange if you're using lstinputlisting, but of course that's sensitive to minor changes in your source file.

If you're okay with using up-to-the-minute releases, looks like minted is working on snippets based on in-file delimiters right now. (This is super handy in mdbook so I'm surprised it took this long for something like this to appear in latex-land.)

Ihmemies
Oct 6, 2012

Yes, those are code listings in my LaTeX document, and I am using lstinputlisting. I did not realize it was possible to only display sections of the source code file in the document, thanks. I'll look into that :v:

Ihmemies
Oct 6, 2012

I have to implement a multithreaded pipeline with C++20. Each process type has a minimum of 4 threads, and I have 4 different types of processes - A generates numbers, B and C process them and D prints them out.

I guess performance is not that critical, correct functionality is.

I thought about making a thread safe queue class, and three queues based on it. AB, BC, CD. Each thread takes/puts stuff from their respective queue. It might be slow, but it also might work :v:

Does it make sense to implement such a solution, or should I look for something else, like non-locking queues, which look extremely.. finicky to implement?

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

Ihmemies posted:

performance is not that critical, correct functionality is.

Print this out in huge bold type above your monitor and refer to it regularly while you design this project.

I'm a masochist for lock-free, wait-free, cache coherent multi-threading insanity (still chasing those 0.25ms DSP latency highs) and it is not worth it in any manner unless absolutely necessary or if you enjoy meticulously boring pain.

ynohtna fucked around with this message at 11:33 on Mar 21, 2024

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The secret to making concurrent programming less painful is to do as little of it as possible.

Which is to say: the parts of your code that deal with correctly passing stuff between threads should only deal with that, and the parts of your code that implement the business logic should not deal with it at all. (Ideally the passing-stuff-between-threads should be handled by a battle-tested library that someone else wrote and maintains, but that's not really an option in an academic exercise where the point is to write that code).

Which is to say: your idea of writing a thread-safe queue, and then using that queue to handle all the handoffs from one thread to another, is a very good plan.

Having all the concurrency code behind a single queue interface also means that you can start with a simple and reliable implementation, and then experiment with more complicated ones afterwards if you have time and feel like showing off.

Ihmemies
Oct 6, 2012

Thanks! The idea felt good but I did not want to start with a foot gun, so I wanted to check. Apparently std::jthread is the current recommended method to create new threads. With that you can also issue stop requests to the threads, which then automatically stops and joins the threads. I’ll be back if I can’t manage to get this to work even after an unreasonable amount of work.

nielsm
Jun 1, 2009



Wrap all your data transfers as futures. Don't share data between threads in any other way.

Xarn
Jun 26, 2015
Good news is that C++20 added some extra synchronization primitives you can use. Bad news is no queues out of the box.

OddObserver
Apr 3, 2009
Don't touch lock-free stuff unless you know what a memory consistency model is; that subject at least used to be rarely thought.

You probably will have bad lock contention because it sounds like a class exercise with a toy example, but if you were doing a significant amount of processing per work chunk the simple stuff would near certainly be good enough and not suddenly blow up when run on a new microarchecture.

seiken
Feb 7, 2005

hah ha ha
Assuming this isn't some kind of school assignment, I can recommend https://github.com/cameron314/concurrentqueue

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If it's not a school assignment I recommend just not using threads at all because caring about correctness more than performance for your multithreaded processing thing is sort of a contradiction.

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.

seiken posted:

Assuming this isn't some kind of school assignment, I can recommend https://github.com/cameron314/concurrentqueue

This is crazy overkill for this usage case vs. a std::queue with std::mutex. I'd do something a lot more like this: https://morestina.net/blog/1400/minimalistic-blocking-bounded-queue-for-c.

I guess if this is for a school assignment, that might be looking at the answer key, though.

giogadi
Oct 27, 2009

I always find it sad when we have to give context like “it’s for an assignment” to justify doing something in a weird (or worse) way. Surely if something is worth learning about in school, then there must be some way to apply it that actually makes sense in practice too.

I think all the time about how I’d teach stuff if I were a teacher, but I wonder how much is out of the teachers’ control due to constraints on curriculum, etc

Adbot
ADBOT LOVES YOU

OddObserver
Apr 3, 2009
It's also a question of assignment complexity. If you want to teach people to write a thread-safe queue, you can have them either write a queue + toy usage, or write a queue + a bunch of other complicated stuff, which is probably a mistake unless that other stuff is also relevant to the course (like if you're writing an OS scheduler or something).

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply