New around here? Register your SA Forums Account here!

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
Asleep Style
Oct 20, 2010

So I want to learn C++. Does anyone have any book recommendations for modern C++? I'm worried if I just start googling and trying things that I'll end up writing C with classes and my code will be posted to this thread for eternity.

Adbot
ADBOT LOVES YOU

Asleep Style
Oct 20, 2010

Kevin Mitnick P.E. posted:

modern c++ is c with templates and an angry horde of nerds strangles you if you use a pointer or throw an exception

pointers kick rear end tho

Asleep Style
Oct 20, 2010

Kevin Mitnick P.E. posted:

yeah i know but c++ programmers are dumb

Sounds like I'll fit right in.

Phobeste posted:

there’s a book called “modern c++” that I think is good idk I never read it

once you have a basic command of the language read and follow these

Word, thanks.

Asleep Style
Oct 20, 2010

Volte posted:

c++'s unique strength is writing parameterized programs that generate specific programs, which is something that most people don't want to do most of the time. they want to write the specific programs directly. it takes a ton of code and consideration of minutiae to write a "correct" C++ template that is suitable for inclusion in a library and people get salty over that fact because they just want to parameterize over the type of some operation and not worry about every potential interaction with other client code's reference types etc

luckily i haven't had to write c++ recently but any template that i'm writing that's not going into a library (which is all of them since i don't write libraries) is probably not going to cover every edge case wrt perfect forwarding and other poo poo that will end up getting compiled out or not even instantiated in the first place because im only instantiating it with ints. it's basically a case of premature optimization if you're working overtime to satisfy client constraints that you made up yourself for no reason

This is a really interesting post. Gonna have to think hard about if these are the type of problems I would like to have at my job.

Asleep Style
Oct 20, 2010

gonadic io posted:

monadic jo is principled jo, you can't escape out of it only >>= it

unless you use unsafePerformJo of course

That's how David Carradine died.

Asleep Style
Oct 20, 2010

bob dobbs is dead posted:

i took linear algebra in 11th grade

us has the best education in the world. mostly for plutocrats tho

I should have been a plutocrat.

Asleep Style
Oct 20, 2010

bob dobbs is dead posted:

not a plutocrat myself, my parents just bought the cheapest place they could find in a weirdo school district that also served plutocrats

it was deffo worth the 200k extra they paid already

I didn't mean it as an accusation, I just would have been stoked as hell to be able to take linear algebra in high school.

Asleep Style
Oct 20, 2010

Current terrible programmer status: saved output to folders in the format 'year-minute-day' instead of 'year-month-day' lol

Asleep Style
Oct 20, 2010

gonadic io posted:

let those who have never sinned cast the first stone

I did this. Turns out in .NET you want "yyyy-MM-dd", not "yyyy-mm-dd"

Asleep Style
Oct 20, 2010

CPColin posted:

Just wait until somebody uses YYYY instead of yyyy in a Java SimpleDateFormat!

The more I learn about date/time issues the more I'm amazed that anything works. What a minefield.

Asleep Style
Oct 20, 2010

brand engager posted:

I'm just over here staring at all our gradle build files

More like grundle am I right?

Asleep Style
Oct 20, 2010

Is there a modern use case for macros besides include guards or platform specific compilation?

Asleep Style
Oct 20, 2010

Thanks everybody, all of those examples are super helpful

Asleep Style
Oct 20, 2010

Space Whale posted:


:q: THEN IT GETS BETTER!!!


Great googly moogly

Asleep Style
Oct 20, 2010

Forgive me if I'm stating the obvious re: unmanaged resources and the billion processes, but if I recall correctly in .NET Process implements IDisposable. If you had a process factory that wrapped these processes in a using block they should get GC'd when they go out of scope.

Asleep Style
Oct 20, 2010

Shaggar posted:

its not so much about unmanaged resources used by the long running task (though you absolutely need to worry about them), but more about the task itself. You need to manage the total number of those long running tasks which is definitely doable, but its one more thing to remember to do properly in your code. Plus your long running tasks need to be incredibly durable as the application pool may terminate at any time and its not going to wait for your tasks to finish (unless you do some kind of hacky stuff).

The design of asp.net is centered around requests being totally independent of other requests. When you adhere to this design it makes things much easier to maintain. Its not designed to handle long running tasks, so there are no mechanisms to handle them built into the framework. This means you need to design them yourself which, while possible, is more code to maintain in a system not designed for what you're doing.

Aside from the code maintenance benefits of separating short and long running tasks, you make it easier to understand the performance profiles of your 2 systems. This makes it easier to scale the overall system since you've separated 2 totally different task profiles into totally different subsystems.

Thanks for posting this, it's super helpful. Truly I am in the right thread

Asleep Style
Oct 20, 2010

Nomnom Cookie posted:

i'm pretty sure the secret to programming success is hubris and ignorance. always believing that you know what you're doing and it won't be very hard to reach your goal, until finally you get there after 20x the originally estimated effort

I should be making a lot more money

Asleep Style
Oct 20, 2010

brap posted:

yeah your compiler should be warning if the first argument to printf is not a constant


uh this isn’t actually a thing is it?

I DECLARE TECHNICAL BANKRUPTCY

Asleep Style
Oct 20, 2010

Powerful Two-Hander posted:

the moral of the story is: whatever you do it's gonna suck in some way and you'll wish you did something else, but you have to deal with that and not get super paranoid about what ifs

or get seriously stoned/drunk and convince yourself there's a multi verse and there's an alternate you out there that did this stuff and is successful, handsome and who makes good posts

I can assure you my posts are terrible in every universe

Asleep Style
Oct 20, 2010

Any recommendations for modern cmake tutorials? It's used for a project at dayjob but I gather that the way it's used is pretty outdated. The project is also relatively mature so I don't need to interact with the cmake portion much outside of adding source/header files to the lists here and there and rebuilding the visual studio solution.

I want to use it for an idiot spare time project but most of the tutorials I find online are contradictory or vague. I can make it work, but I'd like to be more confident that I'm doing it properly and not setting myself up for headaches down the line.

Asleep Style
Oct 20, 2010

Antigravitas posted:

I implore you to use a plain makefile for your idiot project. Always remember there are people who care about you…

Let's assume I have a brain disease and cannot be persuaded otherwise

quote:

:stare:

It's... complicated. The tldr is that a portion of the application is developed on Linux and needs to be integrated into the rest of the application which is windows only. There's nothing I can do about this arrangement

Asleep Style
Oct 20, 2010

Thanks friends. I'll just keep googling and reading documentation

Asleep Style
Oct 20, 2010

VikingofRock posted:

When I was learning cmake a year ago, I remember An Introduction to Modern CMake being pretty good and useful

Thanks, this is actually what I've mostly used so far. It seems the most complete and it's helpful that the example file structure is close to what I'm using

qsvui posted:

Professional CMake is quite thorough and modern. It's written by a maintainer.

Thank you much, I'll take a look at these

Asleep Style
Oct 20, 2010

Sapozhnik posted:

cloud is good because it's an opex cost instead of a capex cost and the rich people who own you like that a lot

Our devops director is real horny for cloud and framing it this way makes a lot of things fall into place for me

Asleep Style
Oct 20, 2010

Achmed Jones posted:

see also i18n for internationalization, a11y for accessibility, etc.

it's a pretty stupid naming trend but it caught on and doesn't hurt anything except my "old man yells at govcloud" bits so 🤷‍♀️

I'0m g3g t0o w3e a1l m0y p3s u3n t2s c8n f2m n1w o0n

Asleep Style
Oct 20, 2010

gonadic io posted:

what's this?

On. 0 letters between first and last

Asleep Style
Oct 20, 2010

Terrible programmer here with a question. This is going to be kind of vague because I haven't worked on this product yet and therefore:
- I'm not very familiar with the codebase
- I'm not very familiar with javascript or web stuff generally
- I'm not very familiar with the pain points caused by the existing workflow

I'm asking anyway because I'll probably have to work with this in the near future and have been asked to explore our options. Let me know if this is unclear and you just need more info

At work one of our products is web based and uses ASP.NET. A lot of functionality is then built on top of that with typescript/react. Right now this is apparently a pain in the rear end to work with and manage, so we'd like to figure out a way to let us use npm. The current best idea is to split out the typescript/react portion, use npm to manage and compile the typescript, and then use webpack to output something that can be used with our existing ASP.NET structure. Is there a better way to go about this?

Asleep Style
Oct 20, 2010

Krankenstyle posted:

yeah imo don't use javascript or derivatives. stick to static pages

would that I could

Asleep Style
Oct 20, 2010

DELETE CASCADE posted:

sounds like you first need to figure out why that is (or why they think so, anyway)


npm sucks so i doubt it will actually solve your problem

I think some of the reasons are:
- The current setup more or less locks us into visual studio, which is not great for typescript vs. vscode
- 3rd party libraries are more of a PITA to manage than with npm

mystes posted:

So right now it's not really an SPA but instead you're using asp.net to serve some static pages as well as a bunch of javascript files manually compiled from typescript for individual pages?

I believe so

mystes posted:

Are the typescript/react parts talking to the server via a rest api right now? Or are you using react just to enhance static pages even though that seems extremely overkill?

They are talking to the server via a REST API

Asleep Style
Oct 20, 2010

Thanks for the advice friends, that helps

Asleep Style
Oct 20, 2010

Soricidus posted:

ctps: trying to work out why the gently caress maven-javadoc-plugin keeps giving an "unmappable character for encoding windows-1252" error when i have explicitly set the encoding to UTF-8 everywhere I can find to change it, and indeed mvn -X claims that it is going to use UTF-8 for everything ... right before it tries to map something into windows-1252 and dies horribly

i mean probably the easy solution is "don't use non-ASCII characters in your comments ever" but i want to

This prompted me to bing whether git accepts any UTF-8 character in a commit message and I'm excited to take my terrible programming to the next level

Asleep Style
Oct 20, 2010

pokeyman posted:

pretty sure machine "learning" has some role here. last time you typed "exce" you chose the Excel result so it remembers that for that query. if you've never typed "excel" all the way out before, it has no history to check. then you choose "search web for excel" by accident and that gets remembered for next time

though i'm not sure why, absent other information, a web search is prioritized over an exact prefix match of an installed application. that seems unhelpful

Microsoft is horny for bing and thinks it's users are too

Asleep Style
Oct 20, 2010

Case insensitivity is a scourge

Asleep Style
Oct 20, 2010

Ciaphas posted:

operator{}() begins the song that ends the world

IO! IO! Cthulhu f'operator{}()'gn!

Asleep Style
Oct 20, 2010

zokie posted:

that was great, thanks

agreed, I would subscribe to this blog

Asleep Style
Oct 20, 2010

I was directed to
https://crascit.com/professional-cmake/
By this thread when I had cmake questions and found it to be well worth the money. I had a hard time separating good examples from bad examples whenever I googled a cmake question

Asleep Style
Oct 20, 2010

ctps: I'm trying to fix a bug where a windows service properly exits if it hits a problem right away (e.g. db connection string is wrong) but it stays alive in a zombie state if it encounters a problem later on (db service turned off). When I run it through the debugger the exception is caught in the same place and I can step it right to the end of the main method in either case :psyduck:

Asleep Style
Oct 20, 2010

That sounds entirely plausible, thanks for the tip. This codebase is pretty new to me, I've got a lot of spelunking ahead of me

Asleep Style
Oct 20, 2010

Bloody posted:

blindly throwing threads around is basically the same as using goto for flow control. maybe worse

it's rude to be talking about my posting like that

Adbot
ADBOT LOVES YOU

Asleep Style
Oct 20, 2010

Is there a good starting point for understanding the purpose of/history of POSIX? The Dan Luu article linked in here about files being untrustworthy was great, so I feel like I know what's going on with that part of the conversation, but I'd also like to understand references to the angry ghost of POSIX

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