the third package manage in cpp?
i want to konw how to manage the third package in easy ways in cpp?xmake or cmake,these tools are so good,but they are not easy to use.
any package manager in cpp like npm in js,or pip in python
https://redd.it/1e96v51
@r_cpp
Performance test for multiple dimension array, and why?
I am developing a CFD solver. I need a 3d array with contiguous memory like one dimensional array, because it will be easy to communicate a 2d slice of data using MPI.
So I write a warpper class to do this, but recently I find that its efficiency performance is worse than raw double.
Here is my testing code.
[https://github.com/CheapMeow/test-mdspan](https://github.com/CheapMeow/test-mdspan)
What I wonder is why all my workaround are worse than raw double?
https://redd.it/1e8eg6y
@r_cpp
Learnt something new today
https://github.com/ZeroMemoryEx/APT38-0day-Stealer
Didn't even realize this was possible, I've compiled random projects without inspecting the vcxproj. I suppose that makes it pretty easy to RAT people by boosting fake popular github projects with botted stars.
https://redd.it/1e8a2rr
@r_cpp
C++ Project: Cryptography Implementation
I've been working on a C++ project called HenceLocker. It's an educational tool that demonstrates various cryptographic techniques.
Github - Hence0x/HenceLocker
Feel free to ask questions
https://redd.it/1e81qvp
@r_cpp
🚀Announcing conjure_enum v1.0.1 - a C++20 enum and typename reflection Library
We're pleased to announce the release of v1.0.1 of [`conjure_enum`](https://github.com/fix8mt/conjure_enum), a lightweight header-only C++20 library designed to streamline working with enums and typenames by providing simple reflection capability.
Yes, there is magic\_enum - and we based this implementation on the core of magic\_enum, but refocused for C++20, using some of the key features of this newer language version such `constexpr` algorithms, `std::source_location, std::to_array` and `concepts`; we also improved and expanded the API.
✨Here's a closer look at what `conjure_enum` brings to the table:
* ***Lightweight***: Designed for performance without additional overhead
* ***Single Header-Only***: No external dependencies, simplifying integration into your project
* ***Modern C++20***: Entirely `constexpr` for compile-time safety, efficiency and performance; no macros
* ***Broad Support***: Works with:
* scoped and unscoped enums
* enum **aliases**
* **gaps**
* anonymous and named namespaced enums and types
* ***Simple & Easy to Use***: Class-based (rather than namespaced) approach with intuitive syntax
* ***Convenient***: `enum_bitset` provides an enhanced enum aware `std::bitset`
* ***Useful***: `conjure_type` gives you the type string of any *typename*
* ***Wide Compiler Compatibility***: Support for:
* GCC
* Clang
* MSVC
* XCode/Apple Clang
* ***Confidence in Quality***: Includes comprehensive unit tests for reliable functionality
* ***Expanded***: Enhanced API:
* `add_scope`
* `remove_scope`
* `unscoped_string_to_enum`
* `for_each_n`
* `dispatch`
* iterators and more!
* ***Transparency***: Compiler implementation variability fully documented, verifiable and reportable
* ***Full documentation***: with many examples as well as example applications
🎉 C++20 features allow c`onjure_enum`to perform most of its work at compile-time, resulting in minimal runtime overhead, while its header-only design ensures effortless cmake integration into your C++20 projects.
Released under the [MIT license](http://opensource.org/licenses/MIT).
🔗h`ttps://github.com/fix8mt/conjure_enum`
https://redd.it/1e7pzf1
@r_cpp
update c++ in Linux
is safe update c++ and gcc to a newer version?
I have c++11 and c++12 in my machine, a linuxmint.
Is safe install a new version, like c++20???
and, too, is the best way, or learn first c++11 to upgrade after?
https://redd.it/1e7gwo0
@r_cpp
Give me 1 minutes & I'll change your view of GDB
https://youtube.com/shorts/-cOQs8jNK5Y
https://redd.it/1e796mv
@r_cpp
AutoConfig: C++ Code Analysis Redefined
https://www.sonarsource.com/blog/autoconfig-cpp-code-analysis-redefined/
https://redd.it/1e77uin
@r_cpp
How to optimize CPU time between two workflows
Hi C++ experts, greetings!
I am reaching out to get some advice on a problem from my project. (Allow me to be a little abstract about the problem so that I don't get myself into trouble.) The gist of the problem is like this. My project is a C++ backend service. It mainly serves two workflows (say A and B). Depending on the operation mode of the client, the QPS ratio of the two flows can go from A:B=1:1 to A:B=1:10. The problem is that flow A is more critical than B (both are important, though; we want to separate them in the long term, but for now we have to solve problems with them together in the same service). And we want A to have lower latency to avoid timeout issues on the client side. Right now A and B share the same CPU thread executor, and their tasks have the same priority. Ideally, we want to achieve the goal for all client operation modes, but it is still a win if we can only achieve the goal for a subset of the modes.
Naively, I think we can achieve the goal by simply bumping the task priority (without setting thread priority) or bumping the thread priority, or both. Unfortunately, I did quick experiments with these ideas, and I don't see any difference in flow A latency. (Of course, it is possible that these ideas may work but my implementation was wrong.) In any case, I feel I should get some guidance besides my naive ideas right now. So, here are my questions.
1. Do you agree that bumping task priority or thread priority are common and reasonable approaches for my goal?
2. Are there other optimization techniques, assuming I can't change the total computation of the flows?
3. About setting thread priority, my understanding is that it heavily depends on the OS config. Do you have some successful experience to share about setting thread priority for optimization in C++?
4. What are common low level APIs for setting thread priority?
5. Do you know good examples of task queue algorithms and/or implementations in C++ that features task priority?
6. How can I observe whether bumping task priority or thread priority is actually taking effect? Logs only?
Thank you in advance.
https://redd.it/1e74lao
@r_cpp
best way to consume API
whats the best way, lib, anything to consume an API?
https://redd.it/1e7004y
@r_cpp
How to target a specific version of a Linux distro with CPack?
How to target a specific version of a Linux distro with CPack? Suppose I want to generate several deb files each one targeting a different version of a Linux distro. How do I do that? My hypothesis is that CPack packages for the version of the distro I am running. Is that correct?
https://redd.it/1e6y86x
@r_cpp
Reflection in current C++
If you want to iterate trough the member variables, for the purposes of let's say serialization you can do it in current C++, you just need to be a bit creative.
https://www.youtube.com/watch?v=sDhOZDjaRgc
https://redd.it/1e6wggy
@r_cpp
Practice Interviews Senior Level
If anybody wants to practice some C++ interview questions these days, please DM me. (Half of the time you'll interview me, other half I'll do you, but we can discuss the format anyway). Cheers!
https://redd.it/1e6fpcn
@r_cpp
Declarative GUI toolkit - Slint 1.7 released with new widgets, multi-window support, and a redesigned Live-Preview
https://slint.dev/blog/slint-1.7-released
https://redd.it/1e69l4o
@r_cpp
C++ Club 172. Safety, Rust, Swift, WG21 papers, Contracts. With Bjarne Stroustrup, Gianluca Delfino, Frances Buontempo, Jody Hagins, Csaba Ráduly et al.
https://youtu.be/dWz6s1oS2RY
https://redd.it/1e8mjsr
@r_cpp
Special Mathematical Functions in C++
Does anyone know of any libraries for special mathematical functions in C++? e.g. Bessel, Error, Hypergeometric, etc.
https://redd.it/1e8gbbw
@r_cpp
vcxproj malware
Reposting this in a better format. Hopefully it will be of use to some people here or at least an interesting read with the article, especially people who only started learning recently. Not really sure if it's better suited to cpp_questions, cpp, or a different sub entirely.
Anyway, this is older news, it was discovered that North Korean hackers were using this method in 2021 to infect security researchers to steal 0 day exploits. However, it's new to me since I've only been learning c++ for a few months.
I recently found out that vcxproj and csproj files can be utilized to execute malware when the project is compiled. Never knew that was a thing. I've downloaded and compiled projects from github or other sources, looking through the actual code to make sure it's safe, without thinking about checking the vcxproj files.
> The malicious script is embedded within a pre-build event of a Visual Studio project file (.vcxproj) and is designed to be executed automatically during the build process. The script consists of two main parts:
>
> A batch script that sets up the environment and executes a VBScript file.
> A base64-encoded PowerShell script that is decoded and executed by the VBScript file.
2024 article on how it's being used on github recently:
https://checkmarx.com/blog/new-technique-to-trick-developers-detected-in-an-open-source-supply-chain-attack/
example of the APT38 Lazarus groups 0 day stealer method: https://github.com/ZeroMemoryEx/APT38-0day-Stealer
https://redd.it/1e8ei5e
@r_cpp
Autogenerate Boilerplate C++ Code
So I posted here a couple months ago about an internal tool at my company that I helped create. People on here seemed interested, and people at my company have found it useful, so I finally made it open source for this community to check out.
The tool is called autogen and it is a C++ code generator based off a provided yaml or xsd schema.
Here are the core capabilities available currently:
1. Generate Protobuf converter classes capable of converting a schema defined C++ message class to a protobuf message.
2. Generate C++ Message classes with built in serialization capability based off a schema.
3. Generate .proto files for the Protobuf compiler based off a yaml schema.
There are some sample template for you to try out but beware that they may not compile fully. Still need to iron out a few syntax tweaks to the templates, but it will give you a general concept of the capability.
I would love to get some feedback on this tool on ways to improve it or how it could be applied to your specific use case.
Thanks, and again, here is the link to the repository
https://redd.it/1e84czi
@r_cpp
Open-Source File Encryption Tool/ Ransomware POC in C++
Just released HenceLocker - an educational file encryption tool demonstrating modern ransomware mechanics.
Features: ChaCha20 encryption, Curve25519 key exchange, and more.
Check it out: https://github.com/Hence0x/HenceLocker
https://redd.it/1e80qfx
@r_cpp
Using Boost Test as a submodule in a project Git repository...
I want to use the Boost Test library to do C++ unit testing. My project uses Git. I tried adding the Boost Test repo as a submodule and writing a simple test, but I couldn't get it to build. So, I spent some time cloning the entire Boost repo and learned how to install the Boost Test library to my Linux system's /opt directory. But, I'd rather not require other developers have to repeat that process. Is there a good way to do this without requiring developers to go off an install Boost to their system? Is there a way I can add Boost Test as a submodule and build/run tests without having developers install Boost to their system?
https://redd.it/1e7ks0m
@r_cpp
Ultra Engine 0.9.6 Released
Hi, I actually became a C++ programmer just so I could design the game engine I wanted to use, and the latest version 0.9.6 just dropped:
https://www.ultraengine.com/community/blogs/entry/2847-ultra-engine-096-released/
The headlining feature is the new foliage system, which uses compute shaders to distribute trees, plants, and rocks across a landscape and efficiently render them.
This engine was created to solve the rendering performance problems I saw while working on VR simulations at NASA. Ultra Engine provides 10x faster rendering performance than both Leadwerks and Unity:
https://github.com/UltraEngine/Benchmarks
I used a lot of multithreading to make this work, with std::bind and lamdas to pass command buffers between threads, liberal use of std::shared_ptr, and a small amount of templates. I did not like C++ at first but now it feels completely natural. Well, except for header files maybe.
Please let me know if you have any questions about the technology and I will do my best to answer. :)
https://redd.it/1e7gint
@r_cpp
How to build highly-debuggable C++ binaries
https://dhashe.com/how-to-build-highly-debuggable-c-binaries.html
https://redd.it/1e79cii
@r_cpp
Voting on the talks of Meeting C++ 2024 has begun
https://meetingcpp.com/meetingcpp/news/items/Voting-on-the-talks-of-Meeting-Cpp-2024-has-begun.html
https://redd.it/1e76djt
@r_cpp
Game Release: Dino Saur (C++, SDL2)
https://github.com/wldfngrs/chrome-dinosaur-2d
https://redd.it/1e71qrr
@r_cpp
New features in C++26 [LWN.net]
https://lwn.net/Articles/979870/
https://redd.it/1e708mh
@r_cpp
Optimizing Compiler
https://github.com/nevakrien/Turing-compiler
I made an optimizing compiler for a Turing machine in C/C++. very happy about the results. It took a lot of work to get here.
going to publish an article on the C++ part of it in a few days (working on writing it) But I am just too happy about the code not to share it.
It was really cool to see how different C and C++ are when approaching similar problems. Not sure if the code I made is an abomination or not. But I think for my first large C++ project I did fairly well.
https://redd.it/1e6xbbl
@r_cpp
How does a young physicist go about becoming confident at C++
Hi,
I got a bit scarred by a "C"
https://redd.it/1e6w0wt
@r_cpp
C++26 Reflection - query comments?
Reading through the latest version of the "Reflection for C++26" paper, and recently having worked on a documentation generator, I got to thinking about what is missing to be able to generate useful documentation without any non-standard compiler work.
Given that source_location_of(info)
exists in the proposal, one big thing missing is something like comment_of/for(info)
.
The biggest issue I see with that is determining, in the general case, what the "comment for" something actually is. The trivial case of something like a member variable with a comment right above its declaration is quite clear, but there are a huge number of special cases. What if there are comments on both the declaration and definition of a function? What if there is more than one comment block? What even is a comment block (as opposed to multiple independent comments)? What if we are looking at an alias that has a separate comment?
Trying to actually define this in the spec seems like a terrible headache, but since this information is likely to be used in a non-functional context, I believe that specifying it in a similar way to source locations (i.e. "best effort") might be sufficient, and far more viable. The only other difficult part I see with it is representing source code as a string, but this is something which already needs to be solved by the reflection paper anyway (and is).
That said, while I think this would open up some very relevant use cases -- specifically, of course, in documentation generation and tooling -- I really wouldn't want it to potentially hold up standardization of reflection for C++26.
Thoughts?
https://redd.it/1e68zc5
@r_cpp