#cpp
Simple HTTP server using C++
https://github.com/etr/libhttpserver
Discussions: https://discu.eu/q/https://github.com/etr/libhttpserver
Ah made a blackjack game in C++. Inspiration hit: Boggle! #boggle #cpp #learning #programming
The trio of std::ranges::find_last, std::ranges::find_last_if and std::ranges::find_last_if_not are C++23 algorithms that find the last element matching the provided value or predicate.
While we could use std::ranges::find on bidirectional ranges with the same effect, these variants can operate on forward ranges.
Compiler Explorer link: https://compiler-explorer.com/z/Mfz7Wj9z6

C & C++ recap for week 21/2023
https://discu.eu/weekly/candcpp/2023/21/
#cpp #cprogramming #programming
Get RSS feeds and support this bot with the premium plan: https://discu.eu/premium
Software Performance and Class Layout - Johnny's Software Lab
https://johnnysswlab.com/software-performance-and-class-layout/
Discussions: https://discu.eu/q/https://johnnysswlab.com/software-performance-and-class-layout/
Constructing a variant alternative from a runtime index value
https://gist.github.com/obidavis/a65e8af309299fc5ebe13f0848d2f398
Discussions: https://discu.eu/q/https://gist.github.com/obidavis/a65e8af309299fc5ebe13f0848d2f398
Sequency, A Powerful C++ Library for Random Numbers Generation!
https://github.com/JoshuaKasa/Sequency
Discussions: https://discu.eu/q/https://github.com/JoshuaKasa/Sequency
Sunday common C++ interview problem: Smallest interval to cover k sorted sequences.
Given k sequences of sorted integers, determine the smallest closed interval that covers at least one element from each sequence. For intervals of the same size should be ordered based on their lower bound value (i.e. [0,2]<[1,3]).
Solve it yourself: https://compiler-explorer.com/z/cqKo5WeMY
Solution: https://compiler-explorer.com/z/eeTMcbzP6

Don’t forward things that aren’t forwarding references
https://quuxplusone.github.io/blog/2023/05/27/dont-forward-non-forwarding-references/
Discussions: https://discu.eu/q/https://quuxplusone.github.io/blog/2023/05/27/dont-forward-non-forwarding-references/
First release! Doxide: modern documentation for modern C++. Configure it with YAML, generate Markdown, publish it for the web with the marvelous Material for MkDocs by @squidfunk. Looking for feedback on this one and contributions welcome #cpp #cplusplus #docs #new #opensource #release https://doxide.org

"What we need isn't diplomacy, it's accountability. We need people to take responsibility for what happened and to make amends."
This sentence will go the list of things to be also said in the C++ community. #cpp #cplusplus #cppcon
Raw string literals (introduced in C++11) simplify the inclusion of multi-line text and strings that contain special characters that would otherwise have to be escaped.
Compiler Explorer link: https://compiler-explorer.com/z/acEeoGrTs

CppCast: C++ in Finance
https://cppcast.com/cpp_in_finance/
Discussions: https://discu.eu/q/https://cppcast.com/cpp_in_finance/
Been sitting on this new release for a while, but it's out now! LibreArp 2.5 brings selection duplication, pattern playback offset, manual time signature settings and a few other usability improvements and bugfixes! Available at the usual spot: https://librearp.gitlab.io/download/
(Yea, I should probably make a separate Mastodon account for LibreArp...)
Basic 3D Game Engine in C++ with OpenGL, glm, Assimp and Dear ImGui
https://www.youtube.com/watch?v=rJXNfAThIbU
Discussions: https://discu.eu/q/https://www.youtube.com/watch?v=rJXNfAThIbU
Finally gotten around to improving my previously horribly convoluted cmake functions for building modules with clang, yay 💪
Idiomatic way to avoid false sharing
https://godbolt.org/z/6sov6sTda
Discussions: https://discu.eu/q/https://godbolt.org/z/6sov6sTda
A Trick for Reflection in C++
https://sillycross.github.io/2021/08/23/2021-08-23/
Discussions: https://discu.eu/q/https://sillycross.github.io/2021/08/23/2021-08-23/
New post! What is TAP and why do I love working with it? I'll tell, and show how to use it in different setups and languages, like C++, Lua, JavaScript, or even PostgreSQL.
https://martin-fieber.de/blog/tap-test-anything-protocol/
#TAP #TestAnythingProtocol #Cpp #Lua #JavaScript #Python #CSS #PostgreSQL
What’s the right hash table API?
https://brevzin.github.io/c++/2023/05/23/map-api/
Discussions: https://discu.eu/q/https://brevzin.github.io/c%2B%2B/2023/05/23/map-api/
ISO C++ WG21 2023-05 Mailing
https://isocpp.org/blog/2023/05/2023-05-mailing-available
Discussions: https://discu.eu/q/https://isocpp.org/blog/2023/05/2023-05-mailing-available
Last time I did cross platform mobile dev I was using jdk 11. Today I just installed jdk 17 to get the latest toolchain up an running.
Currently I am:
- relearning c++ after 20 years
- relearning react native after (?) years
- learning rust
- security reviewing some php code
- security reviewing a mysql setup
I hope it pays off in the end.
#ReactNative #Cpp #Rust #Java #Android #iOS #Swift #PHP #MySQL #SecOps
That may seem like tag spam but I have actually been doing all of that in one week.
At least I get to sit outside while working.

I've been on a couple of #Cpp #CplusPlus pod casts with #CppClub recently: https://cppclub.uk/meetings/2023/161/ and https://cppclub.uk/meetings/2023/161/
They are a great way to keep up to date and have both been very interesting.
A very interesting read:
https://kobzol.github.io/rust/python/2023/05/20/writing-python-like-its-rust.html
Some excellent ideas in there for people who come from tighter-typed languages like C++ and Rust.
On a personal note, I find writing type-aware code more satisfying. However, for needs where scripting, rather than actual software-hardware engineering is required, there is no beating python. Type-aware, functionally-leaning python is an excellent compromise that adds joy to the coding experience (for me) !
「 Not differentiating between C and C++ also has the side effect of ostracizing new users. Many beginner programmers are lead by the term “C/C++” to think that they’re basically the same language. In fact there are many tutorials out there that are advertised as “C/C++ tutorials”, continuing the confusion. This can also scare away C beginners by making them think that understanding the complexities of C++ are required to understand C 」
via brycevandegrift.xyz
#C #Cpp
https://brycevandegrift.xyz/blog/stop-saying-c-and-c++/
CppCon 2022 Best Practices Every C++ Programmer Needs to Follow – Oz Syed
Question: is a C++ member function defined inside the class definition inlined in the final binary or not?
PS: If you are going to ask about some specific standard, let's pick, say, C++17.
C++17’s Useful Features for Embedded Systems
https://interrupt.memfault.com/blog/cpp-17-for-embedded
Discussions: https://discu.eu/q/https://interrupt.memfault.com/blog/cpp-17-for-embedded
C++20 Support Comes To C++/CLI
https://devblogs.microsoft.com/cppblog/cpp20-support-comes-to-cpp-cli
Discussions: https://discu.eu/q/https://devblogs.microsoft.com/cppblog/cpp20-support-comes-to-cpp-cli
🦀 Article on why Qdrant chose Rust over Java/Scala/C++/Python?
https://qdrant.tech/articles/why-rust/
#rustlang #crablang #programming #java #cpp #python #MachineLearning #artificalintelligence
[Using std::cpp] The C++ rvalue lifetime disaster - Arno Schödl. think cell
https://www.youtube.com/watch?v=Tz5drzXREW0
Discussions: https://discu.eu/q/https://www.youtube.com/watch?v=Tz5drzXREW0
#Cpp lawyering time: Given `p` of type `T*` (with `T` not a character/byte type), `&*p` requires `p` to actually point to an object or function — but must it be of type `T` (up to signedness)?
See What's Coming in Visual Studio 2022 UI "Design Refresh"
https://visualstudiomagazine.com/articles/2023/05/11/vs2022-ui-refresh.aspx
Discussions: https://discu.eu/q/https://visualstudiomagazine.com/articles/2023/05/11/vs2022-ui-refresh.aspx
Building a baseline JIT for Lua automatically
https://sillycross.github.io/2023/05/12/2023-05-12/
Discussions: https://discu.eu/q/https://sillycross.github.io/2023/05/12/2023-05-12/
Feedback requested: Slint (declarative GUI toolkit) is discussing license changes
https://github.com/slint-ui/slint/discussions/2706
Discussions: https://discu.eu/q/https://github.com/slint-ui/slint/discussions/2706
How NanoMQ had a double free and what we can learn from it or why i ditched C++ for Rust
https://nereux.blog/posts/nanomq-double-free/
Discussions: https://discu.eu/q/https://nereux.blog/posts/nanomq-double-free/
The New Boost Website Goes Beta
https://cppalliance.org/boost/2023/05/09/New-Website.html
Discussions: https://discu.eu/q/https://cppalliance.org/boost/2023/05/09/New-Website.html
C++ has been around for a long time but has changed significantly since 2011. A new standard, referred to as C++11 was introduced then, marking the beginning of a new era of frequent updates.
If you haven't used C++ since before C++11, you have a lot to catch up on, so where do you start? No worries, Frances Buontempo has you covered: https://bit.ly/3Bhnt7Z
💾 8.7KB and I got working engine with timer :)
Now it's time to move all the remaining code and my ray-marching shader!
A collection of lock-free data structures written in standard C++11
https://github.com/DNedic/lockfree
Discussions: https://discu.eu/q/https://github.com/DNedic/lockfree
Latest approach to the smallest OpenGL/C++ one shader renderer.
I tricked the #ChatGPT by starting the chat about demoscene and sizecoding. Then get it to generate relevant code :)
Current size 7.5KB 💾
Was C++ always super annoying to work with, or did I just grow dumber with age? Was Visual Studio always so fragile and error-prone, or did I just get used to good IDEs?
Confusingly, VS Code seems massively better than Visual Studio. Intellisense handling for TypeScript in VSCode seems so much more stable than it does for C++ in VS.
Wasn't VS supposed to be an upgrade from VSCode?
Wasn't C++ supposed to be more type-safe than TypeScript?
The Future of Boost by Vinnie Falco
https://lists.boost.org/Archives/boost/2023/05/254612.php
Discussions: https://discu.eu/q/https://lists.boost.org/Archives/boost/2023/05/254612.php
How to make smaller C and C++ binaries
http://ptspts.blogspot.com/2013/12/how-to-make-smaller-c-and-c-binaries.html
Discussions: https://discu.eu/q/http://ptspts.blogspot.com/2013/12/how-to-make-smaller-c-and-c-binaries.html
🤸 Building a Physics Engine with C++ and Simulating Machines
— AngeTheGreat
#Gamedev #PhysicsEngine #Cpp #CPlusPlus
https://m.youtube.com/watch?v=TtgS-b191V0&feature=youtu.be
build.h is now Wilco! 🥳
Still got ways to go and is mostly powered by sunken cost fallacy, but getting a name on it feels like a symbolic but important step.
A status update on the build system, since I know you're all dying to know... 🙄
Having custom commands with proper dependencies turned out to be a hassle, BUT I think I got it working properly. Needed to have the command manually write "tlog" files for MSVC to track changes. Hard to figure out, but simple to do.
Actually starting to run out of big obvious pieces missing, which is cool.
Still procrastinating things like deciding on a name though...
Let's settle this once and for all.
#programming #gamedev #webdev #cpp #java #javascript #python #c #csharp #html #typescript #kotlin #go #golang #rust #rustlang #clang #texteditor #ide #coding #code #poll #automation #shell #bash #powershell #basic
Wow, OK, I read a lot of cursed code, but this is something else.
https://devblogs.microsoft.com/oldnewthing/20230403-00/?p=108005
I'd almost given up on getting properly sequenced custom build steps working in VS/MSBuild in a satisfactory way (i.e. not involving too re-running stuff always), but I just got a lifeline thrown to me in the form of <UpToDateCheckInput>.
It allows explicitly adding inputs/outputs to Visual Studios early exit up to date checker, so it understands that it should trigger a build when an input to a custom target has changed.
I realize I'm talking into a bored void here, but still.
We had a great time organizing our first in-person event after the pandemic! The event revolved all around software development with Qt. Over 20 talks about #qtdev, #rustlang, #embedded, #qml, #python and #cpp are available for you on our YT channel!
🔗 https://www.youtube.com/playlist?list=PL6CJYn40gN6h5jKSLw0cEsKficprxd2iX
========== Elapsed 2:06 PM ==========
Visual Studio, that's not a duration. That's not how clocks work.
📰 KDAB News 03/2023 - Interview with KDE's Adam Szopa about KDE Akademy 2023; Calls for speakers for Qt Desktop Days & Qt World Summit 2023; Embedded World 2023 Recap and more #qtdev #cpp #cplusplus #embedded #desktop
🦀 "Why the Rust Community Should Be Worried About the New Carbon Language"
👉 should we?
👉 If we some language can do what Rust can do but more simpler, we should be happy to switch but is that the case here?
Chapter 5 of my C++ book is now up:
Playing with a full deck! Learn to work with classes, constructors, comparison operators, and random shuffle as you create a full deck of cards and write a fun card-guessing game.
https://www.manning.com/books/c-plus-plus-bookcamp #Cpp #CplusPlus
@ManningPublications are running a MEAP flash sale at manning.com with all MEAPs 45% off. Offer expires midnight ET, March 29. Buy my book #CPP #CplusPlus https://www.manning.com/books/c-plus-plus-bookcamp, someone else's book or just look at all the books.
🦀 NIST(National Institute of Standards and Technology) added Rust to list of Safer languages list
https://www.nist.gov/itl/ssd/software-quality-group/safer-languages
For anyone following along, I'm refactoring a bunch of dependency checking to be better and faster, with the downside that it keeps more saved state. I think it'll turn out good though.
But honestly it's already fast enough. I'm really just procrastinating polishing things up and fixing some msvc & ninja generation issues.
Replacing "input timestamp > output timestamp" based dirty checking with an
"Input timestamp changed" based one turned out to be more complex than I anticipated.
When it's working enough to do better testing I may have to evaluate if it's worth it. It can possibly be faster and also have better tolerance with low precision timestamps, but I'm worried all the statefulness makes it brittle.
The C++23 added the std::spanstream, effectively a std::stringstream equivalent operating on a borrowed contiguous range.
std::spanstream can be used to directly parse text stored in raw memory, string_views or string literals.
When using std::spanstream for writing, the std::spanstream will write as much output as fits into the output span, which can be inconvenient.
Compiler Explorer link: https://compiler-explorer.com/z/occYKs4d5
Switching From C++ to Rust, https://laplab.me/posts/switching-from-cpp-to-rust/.
> After all of this, coming to Rust feels like I was suddenly forgiven and moved from Hell to Heaven.
Interesting testimony. The author mention Build system, Compiler, and Type System.
Okay, so it just seems like for whatever reason the MS STL iostreams implementation is doing something different than others, making reading a full file with iostreams slower than with fread.
Building my test with mingw or on WSL (I'm currently on Windows) makes iostream & fread equally fast.
Christian Adam has found the same things here: https://cristianadam.eu/20160410/c-plus-plus-i-slash-o-benchmark/
Is it just me or is fopen/fread quite a lot faster than ifstream even for just reading a binary blob? I don't have isolated benchmarks right now, but implementing a "readFile" function in my build with FILE* instead of ifstream yields a 10% total speedup, and according to the profiler the time of the ifstream version was ~20% of total runtime. So... A 2x difference on the readFile itself maybe, which sounds insane?
Most of my comments in ITDEV-185 leaned more towards being "normal" (because this time, I knew someone else besides me was reading them). #cpp