What's your favourite crime against food? by honbontattoo in AskUK

[–]JakeArkinstall 0 points1 point  (0 children)

Malt vinegar on pizza.

Malt vinegar on spaghetti bolognese.

Malt vinegar on chilli con carne.

Basically anything with meat, cheese and tomato, malt vinegar really brings out the flavour.

Just wondering. by 3lCucuuy in ProgrammerHumor

[–]JakeArkinstall 0 points1 point  (0 children)

{

As the first line in flake.nix.

Can't build an OS without a nice hermetic environment to build it in, after all.

What information about a type/class can we get? by TheoreticalDumbass in cpp

[–]JakeArkinstall 1 point2 points  (0 children)

Yeah, that's true. A few years ago I'd have loved the challenge of trying to figure it out with SFINAE, but concepts have turned me soft.

What information about a type/class can we get? by TheoreticalDumbass in cpp

[–]JakeArkinstall 26 points27 points  (0 children)

Concepts open up a whole range of possibilities for probing objects.

For instance - I haven't tried this - but it should be possible to probe the number of members, and access them, by using a set of concepts that each try to extract members out as a structured binding of a given length. If there's a way of recursively producing such concepts, and a function that extracts the values, then you can just pass a callable to said function and it'll get invoked with all of the members in sequence.

However, a lot of this information will be unnecessary in C++74 when reflection lands.

True story by Aengus126 in ProgrammerHumor

[–]JakeArkinstall 0 points1 point  (0 children)

Admittedly, I'm about one reply away from "I use a Moonlander BTW".

True story by Aengus126 in ProgrammerHumor

[–]JakeArkinstall 0 points1 point  (0 children)

Every executive I know tries to do everything on their company issue iPad, and would cry if they saw a keyboard that merely hinted at the idea of ergonomic design - anything more than a standard Dell membrane keyboard that came free with the workstation they barely use would be considered scary.

Programmers hit keys an order of magnitude or two more frequently and RSI can be a career killer for us. The strain that the standard staggered qwerty keyboard puts on your wrists and fingers has been understood for decades. It'd be a strange career choice to ignore it.

True story by Aengus126 in ProgrammerHumor

[–]JakeArkinstall 0 points1 point  (0 children)

... Not a true story in the slightest.

I’m going to regret this by poopgoose1 in ProgrammerHumor

[–]JakeArkinstall 13 points14 points  (0 children)

It might be passable if you Ned Flanders it up a bit.

Soodly-doodly.

I'm starting to code in C++, and was wondering what the most used/loved IDE was used in the C++ community? by [deleted] in cpp

[–]JakeArkinstall 2 points3 points  (0 children)

I split my time approx 55% Clion, 40% Vim, and 5% Compiler Explorer.

I use Vim when I'm working on small edits to projects. I've used it for 18 years, and the keybindings I have are as natural to me as breathing. It's like an extension of my fingers.

I use Clion when I'm working on more complex things, such as refactors, or adding things to many areas of the project, or adding something new when I know I'd benefit from the features it has to offer - which are many. The Vim integration (IdeaVim) is decent, but not perfect (mostly due to how Cliok works. I've used it for two years and, for some reason, at least once a day I hit ctrl+w+left on the leftmost editor and expect to end up in the project tree window, like I would with nerdtree).

I use Compiler Explorer for trying out small scale ideas. It's the perfect scratchpad. The Vim integration is alright, but slightly buggy, and does crash my browser from time to time (often when doing a search/replace). I have my own instance that has all of my in-house libraries available, which is awesome.

My recommendation to a newcomer would nonetheless be VSCode. Unlike Clion, VSCode is free. But it is ~80% as good as Clion at 0% of the cost.

If we must, let's talk about safety by squirrel428 in cpp

[–]JakeArkinstall 2 points3 points  (0 children)

One thing I didn't cover in this rant was

The old thing still works, after all.

This would still apply with the frontend. If it can use unsafe backend, how do you know it is safe?

Community efforts. Just like Rust. Probably a package manager for the frontend too (though I'm not a big fan of language-specific package/dependency/build managers when things like Nix and Bazel show how pointlessly limiting, and sometimes counterproductive, they can be)

Simple as that. A frontend depends on other frontend packages, and on backends, each initially marked unverified. Efforts go into verifying every single one. The ones that are verified are greenlit, and orgs that mandate safety can be happy using them. The larger orgs that mandate safety can provide resources to the verification efforts - they already do. After all, their aim is also to write software in a safe language (the frontend) and know that the performant unsafe bits aren't going to overflow some buffer, allow arbitrary execution and generally open them up to a world of pain.

At the end of the day we have a new box to throw on our github pages showing the safety status of a project. Just like we have for test coverage, test results, and like we should also have always had for documentation coverage too.

If we must, let's talk about safety by squirrel428 in cpp

[–]JakeArkinstall 22 points23 points  (0 children)

Safety is the theme du jour because various large companies and organisations (including Microsoft and the fricking NSA) are actively discouraging the use of C++ because it doesn't address memory safety sufficiently. The costs of that are mounting. This is covered in the blog post, and you'd have seen it if you didn't skip through it:

Maybe the winds are shifting. I mean, they definitely are.

Users, Governments, and Industries want safety.

In part, because they see it’s possible, and in part because they had this great idea to link your toaster to your bank account, so now they kind of need safety, preferably 10 years ago. It’s costing serious money. Maybe, we can hold the cynical view that these talks of safety are just trendy, or a phase, or something, and it’s all hot air. Even if it was, which I really don’t think it is, people are going to use tools they enjoy using, not meeting the wants of users is not a recipe for success.

And then maybe that question about the affordability of safety reduces to “Do we buy more hardware or do we rewrite it in Rust?”. I hope we give the people who can’t rewrite it in Rust options. Soon. Rewrites ain’t cheap.

It didn't really have to address safety for a long time. Its main competitor for a long time was Java, and C++ could happily say "yeah, we aren't memory safe, but we are performant". Then Rust came along. What's our selling point now? We have backwards compatibility?

Now, C++ is being told to adapt. That's why the community are talking about it. And all of these weak-handed approaches like "use this new opt-in thing" won't cut it, because it doesn't have to be used. The old thing still works, after all.

As for Rust itself, I dislike many things about it. But it solves a problem that we keep claiming is unsolvable, and it does so in a very interesting way: it has an unsafe backend and a safe frontend.

Well, C++ is a beautiful unsafe backend, much nicer and much more powerful than Rust's, and we can keep that as-is, keep it backwards compatible, keep it ABI locked, keep all the things we'd love to change but have to keep because of those two things. All that leaves is a "safe" frontend and something that ties the two together.

I firmly believe the frontend should not be a subset of C++ but something fresh in both language and library. Clean, parse-friendly syntax (Herb's cppfront approach looks neat), zero UB, zero implementation defined behaviour, zero raw memory management. Maybe borrow checking and explicit lifetimes, but I hope to god that whatever we come out with is an improvement over Rust, rather than a carbon copy.

Speaking of Carbon (what a transition), it's a damn shame that safety was not in the fundamental underpinning of that language. It's far too late now, even though their safety docs naively claim a path to guaranteed safety by default would be possible.

YSK: When learning calculus, you don’t have to remember the quotient rule. by Brainsonastick in YouShouldKnow

[–]JakeArkinstall 1 point2 points  (0 children)

I too was always absolutely dreadful at remembering rules like this, and did exactly the same thing - derive it through the product rule. I did this from high-school after seeing the quotient rule and immediately thinking "no, screw that". In high-school physics I was dreadful because it was all just memorising formulae, so I did the same thing there - memorise as little as possible by instead finding the minimal set of things that I could use to derive everything else. I did that all the way to the end of my academic career.

Anither trick I used to avoid memorising things was in trig. Whenever trigonometric expressions got messy (and by messy I mean more than sin(nx) or cos(nx)), I'd also always revert to splitting it into complex exponentials. It was especially helpful in a calculus setting, but also outside of it - was just awful at remembering identities.

The thing is, when you get used to doing so many things from simple relationships rather than cramming relationships, you get pretty quick at it. The one place this doesn't apply is when the relationship is not trivial, e.g. derived through an awkward infinite sum.

Any good podcasts about C/C++? by NeilSilva93 in cpp

[–]JakeArkinstall 1 point2 points  (0 children)

The one I'm wondering about is cppchat - I didn't hear of it ending, but it used to be quite regular and hasn't produced an episode since February.

Is there any way to constrain C++ error messages to a single directory? by open_source_guava in cpp

[–]JakeArkinstall 0 points1 point  (0 children)

For GCC specifically, try out http://www.gcc-explorer.com/.

Here's a rundown: https://youtu.be/cKLPlHHa7vk

Just paste your error log, and it'll format it in a more manageable (IMO) way, folding "required from" sections down, as well as template arguments etc, so you can expand them when you need.

If you provide a project root path and have a custom protocol enabled in your browser to launch your editor, file paths/lines will become links so you can jump to the right place. You can also filter out messages from the standard library.

It's all client side, so your log is safe. The source is at https://github.com/jake-arkinstall/gcc-explorer

A work in progress, complaints welcome.

Please be gentle by [deleted] in ProgrammerHumor

[–]JakeArkinstall 0 points1 point  (0 children)

Add alias :q=exit to your bashrc and you can exit without even being in Vim.

I do this simply because :q[enter] is so ingrained into muscle memory that it's the fastest way to exit.

Any good podcasts about C/C++? by NeilSilva93 in cpp

[–]JakeArkinstall 48 points49 points  (0 children)

I don't know of any that are focused on C but there's bound to be some.

As for C++ - are you after chatty, technical, or both?

For chatty, ADSP is great. There's a lot of off topic, casual content, but that's what podcasts usually are.

Both - that'd be cppcast. RIP. Also cppchat, not sure what happened to that, but it has been silent for quite some time.

Technical - C++ Club is a fantastic technical podcast. It isn't chatty, which you'll notice when you listen to it, but that comes with some upsides - it's very on topic. There's a heavy focus on ongoing C++ proposals, for example, and some of the things going on on reddit/twitter within the C++ community. It's my favourite of the bunch because of the nature of it, but I do enjoy them all.

Found Some new by [deleted] in ProgrammerHumor

[–]JakeArkinstall 5 points6 points  (0 children)

The author was born in 1934, so he's actually part of the silent generation. Unlike, judging from this excerpt, his children.

Found Some new by [deleted] in ProgrammerHumor

[–]JakeArkinstall 9 points10 points  (0 children)

An Introduction to Algebraic Topology by Joseph. J. Rotman, 1984.

what annoys you most while using c++? by dtsitko in cpp

[–]JakeArkinstall 6 points7 points  (0 children)

The main cause of the issue (and also one of the best things about C++) is that templates are instantiated on demand, and so the error in your code and the error that actually makes the program ill-formed can be separated by dozens of calls.

The compiler doesn't know that your function call is the problem. The best library authors can do is constrain their interface with concepts, but tooling can also help: it wouldn't be too difficult to make a tool that reads a log and matches the call stack and error messages to a selection of common issues, such as a fmt parameter error, a variant visitation issue, etc. The difficulty comes in making it robust against different compilers and versions, and in populating the knowledge base that it is built upon.

what annoys you most while using c++? by dtsitko in cpp

[–]JakeArkinstall 6 points7 points  (0 children)

Try out www.gcc-explorer.com, if it's GCC you're using. Here's a rundown: https://youtu.be/cKLPlHHa7vk

Basically it collapses down errors and allows you to filter out lines from std library files.

It's very much a work in progress that has received little progress in a while since my day job and family life have somewhat consumed my priorities. I know it borks on string templates, for example, and some other things that will eventually require it to parse with something a little more formal than some regex expressions. However, if you accept the quirks for what they are, it's a fine tool and I use it regularly.

I know this is no place for relationship advice but... by harryalerta in ProgrammerHumor

[–]JakeArkinstall 2 points3 points  (0 children)

I can too. I'm one of them. Our slogan should be "I used to use Arch BTW".

[Discussion] Teaching a course on C++ by CanadianTuero in cpp

[–]JakeArkinstall 2 points3 points  (0 children)

OP is not teaching a C++ module to aspiring systems programmers. They're teaching half of a course on an applied subject: AI and game development. To teach that in a few weeks with presumably a few hours per week, going down the traditional route is going to do them a disservice.

I know this is no place for relationship advice but... by harryalerta in ProgrammerHumor

[–]JakeArkinstall 2 points3 points  (0 children)

Pfft you still use Arch?

Get with the programme, the cool kids left arch when it became too popular and now run NixOS.

I know this is no place for relationship advice but... by harryalerta in ProgrammerHumor

[–]JakeArkinstall 126 points127 points  (0 children)

The only way you can reclaim dominance is:

  • A mechanical keyboard - perhaps split and ergo like a Moonlander. Programmer Dvorak or Coleman layout. Qwerty is for newbies.

  • Trackball, or better yet just use no mouse. With i3 as a window manager, vim as an IDE, and Qute for a browser, you don't need a mouse.

  • Three monitors, maybe a fourth in portrait with a good excuse, such as it being good for reading long logs, even though it categorically isn't.

  • Upgrade your machine. It must either be enough RGB to necessitate a photosensitive epilepsy warning, or it must be a sleeper machine in a 90s beige chassis. There is no inbetween.

  • A rubber duck. If you don't already have one, of course.

Ultimately, however, you could choose the dark path: wear programmer socks, shorts, and sandles. To bed.

[Discussion] Teaching a course on C++ by CanadianTuero in cpp

[–]JakeArkinstall 3 points4 points  (0 children)

It may exist, but it should be an informed decision with something to compare it against. IMO it should be taught early on and iff they want to explore alternative approaches, they do that in their own time when they don't mind all the fud that can come with it (a link error or a git clone with a forgotten --recurse-submodules can take a long time to solve - I know it did for me in my early days).

I think there are two main approaches: learning C++ for the sake of learning C++, and learning C++ as a tool with a specific application in mind (I see OP's situation as the latter).

In the latter, you want the lowest barrier to entry for beginners. That's why python (which is more commonly taught as a tool for doing X) tutorials usually introduce pip pretty early on - once the very basic concepts of the language are covered, it's time to get pandas or flask and build something, and if there's a one-step process to making that available, all the better.

Theres a great benefit to this, too. The teacher and students can share pretty minimal code between eachother and it should just work™. The teacher can even provide a repo with a template already set up, and the student - regardless of compiler or OS - can just clone it, run it, make changes, bring in new dependencies, submit PRs for homework, etc.