es
Feedback
C++ - Reddit

C++ - Reddit

Ir al canal en Telegram

Stay up-to-date with everything C++! Content directly fetched from the subreddit just for you. Join our group for discussions : @programminginc Powered by : @r_channels

Mostrar más
228
Suscriptores
Sin datos24 horas
-17 días
+130 días
Archivo de publicaciones
Been using C++ for... long enough... TIL Never ceases to surprise me how little I know despite using this language almost everyday! I've just discovered that not all containers allow forward declared types by the standard. MSVC has let me get away with some cool things and GCC11 taught me the ways. Container in question was a std::unordered_map<>. The standard does state that vector<>, list<> and a couple others should support forward declared types. This all makes enough sense to me, a container needing to know the Types size and all, whereas a vector/list can easily keep that as a pointer type until much later. But it really made me sad because I wanted the container to own the contents, and the Type it contained was the class it was part of. Thankfully this was supported in GCC12 and I was able to update! struct MyType { typedef std::unordered_map<Key, MyType> MyContainer; MyContainer container; //more stuff }; It was an interesting thing to stumble into and while I saw a few options before updating to GCC12, I didn't want to take any of them. Thankfully got it working, what a fun time! (Edited for formatting https://redd.it/1gj0j1a @r_cpp

... having problem I am really finding arrays tough ..I am doing it from PW skills ...where should I study arrays and strings??? . should I continue with PW skills https://redd.it/1gimiik @r_cpp

Open source in c++ I want to start open source and I only know c++. How can I find beginner friendly projects in c++ preferably? Thanks https://redd.it/1gidy7o @r_cpp

Projects for HFT firms Hey im undergrad very interested in exposing my self to c++ only really know java and a wee bit of c, im wanting to get into any HFT firm but most of them work in c++ or at least require you to know it, what type of projects or things can i do in order to learn c++ that relate to HFT https://redd.it/1gidpu5 @r_cpp

Learning C++ for Unreal Hi! I really want to make video games but I am not sure how to learn C++. I learned a lot of C++ on studyplan.dev and it really helped me, but I got stuck on pointers and stopped. I started learning C# from this video: https://www.youtube.com/watch?v=ALXpVlPYqYE which really helped me a lot with c#! I realized that a lot of the topics in c# I already knew from C++. I am currently sticking with C# and just started learning the basics of Monogame and Unity code. However, I really want to learn C++, and I am not sure how to do it. I tried learncpp.com but every time I learn a new topic it says something about a different topic that I don't remember doing, and I have to inevitably redo an entire module. What should I do? I currently am going to stick with learning Unity, so I understand the basics of game design, but how should I learn C++ as well? It's a very confusing language. https://redd.it/1gibqvj @r_cpp

Breaking CityHash64, MurmurHash2/3, wyhash, and more... https://orlp.net/blog/breaking-hash-functions/ https://redd.it/1gi4f1l @r_cpp

New fast compression library I've created a compression library with built in deduplication, i.e. it finds identical 4 KB blocks across entire input even if it's terabytes in size. The main motivation was speed where it uses a method to reduce the number of expensive hashtable lookups. I'm currently not so interested in feedback on the code, usability or bugs. I created it in 2010 when I was a beginner and have now revived it, just to the point where you can run and test it. I'm more interested if it still performs well or if it's outdated or usefull at all. https://github.com/rrrlasse/libexdupe Uses CMake and runs on Windows and Linux. It contains the library with a small demo.cpp file. If I run it with compression level 0 on a ramdrive, I get 5 gigabytes/second with 4 threads (note that the initial allocation of the hashtable takes some time). Not all data benefits from deduplication though. Things like programs or virtual machines are good candidates. You can use tar with the tool and experiment :) https://redd.it/1ghzvyn @r_cpp

How to find memory problem? Valgrind does not catch it... Dear all, I am struggling to find a problem that seems to be a memory problem. My code does not give me good results so I compiled it in Debug and I ran GDB on it. I realize that at some point when I enter a while loop, a couple of variable change and they should not. It really sounds like a memory problem, but when I run it through valgrind, it comes back clean. Do you guys have any idea or tip to debug such a problem? The exact part where I see the error is here : ... mScalar error = 0; for (i = 0; i<n; i++) error += (sigmaPBar[i]-meanStress[i])*(sigmaPBar[i]-meanStress[i]); iteration = 0; maxIterations = 200; mScalar maxError = 1.e-8; while ((error > maxError) && (iteration < maxIterations)) { ... Once it goes the first time through the while statement, the variable error is set back to zero.... It obviously looks like a memory problem somewhere, but since valgrind does not catch it I do not know what I can do.... Thank you! https://redd.it/1ghvddx @r_cpp

CEF Tutorials I want to make a mini web browser that uses chromium (I already made it with electron, but I want to switch to chromium to be more lightweight). Are there any tutorials I can watch on YouTube or any articles that could help me set up the environment and all the dependencies? https://redd.it/1ghorsa @r_cpp

Why their considers C++ as memory unsafe language? https://thenewstack.io/feds-critical-software-must-drop-c-c-by-2026-or-face-risk/ ONC Report Here Why they, event interchagably using C and C++. Memory safety (and overall resource safet) is VERY important topic so why they one of tool that have memory safety mechanism considers with the same category like tool with was designed to doesn't have one? C should be used only on low level when you need directly access hardvare, using it, f.e. in application code, but changing file extensions to *.cpp doesn't means that code magically become (valid) C++ https://redd.it/1ghg9qc @r_cpp

How relevant is C++ in libraries or archives? Hello, I have a professor who mentioned that C++ is important and useful in libraries and archives but he didn't really go into much detail about it. I was wondering if anyone could tell me how useful and important it actually is. As a potential archives student, I'm curious. https://redd.it/1ghcdk5 @r_cpp

Is there a way you can construct Huffman Coding without creating a tree? I'm working on a problem that involves generating Huffman codes for a set of characters without constructing a Huffman tree. Here’s the data I have: |Character|Frequency| |:-|:-| |A|45| |B|13| |C|12| |D|16| |E|9| |F|5| # Tasks: 1. Use Canonical Huffman Coding to generate codes. 2. Use a Frequency-Based Approximation for generating codes. If anyone could help explain how to approach this or provide examples, I'd really appreciate it! https://redd.it/1ghc5jr @r_cpp

I need some final year project ideas I am learning C/C++, data structures and algorithms and full stack development. Please suggest some major computer science project ideas which can be completed in 5 months using the things i am learning. https://redd.it/1gh8fql @r_cpp

Optimizing C++ Memory Management with a Custom Memory Pool for My Game Engine I recently wrote about my journey building a custom memory pool allocator in C++ to improve memory management in my game engine. Here are some of the highlights: # Key Design Choices * **Chunk-Based Storage**: Each chunk can either store an object or point to the next free space, optimizing memory reuse. * **Efficient Allocation & Deallocation**: By using a free list, deallocated memory is immediately available for new allocations, making it faster than standard `new`/`delete`. * **Exponential Growth**: The pool grows in size dynamically when needed, either in fixed or exponentially larger blocks, which minimizes resizing overhead and fragmentation. # Benchmarks I compared the memory pool against standard allocation, focusing on allocation, deallocation, and reallocation. The pool consistently outperforms standard allocation at scale, especially in high-frequency allocation scenarios common in game development. # Why This Matters Efficient memory management is crucial in game engines where objects are frequently created and destroyed, like particles or projectiles. The memory pool minimizes heap fragmentation and speeds up memory access, which gives games that extra boost in performance. If you want to dive deeper, check out the full post [here](https://medium.com/@pigeoncodeur/optimizing-c-memory-management-with-a-custom-memory-pool-4738fee3ad72). Let me know if you've built or used similar memory management tools! Would love to hear about other approaches to handling performance in C++. https://redd.it/1gh8ala @r_cpp

LLQL: Running SQL Query on LLVM IR/BC with Pattern Matchers Hello everyone, After i landed my first diff related to InstCombine in LLVM, i found that using the Pattern Matchers functions to detect pattern is interesting, and i thought maybe i can make this pattern work outside LLVM using SQL query, so i built LLQL.
define i32 @function(i32 %a, i32 %b) {
  %sub = sub i32 %a, %b
  %mull = mul i32 %a, %b
  %add = add i32 %sub, %mull
  ret i32 %add
}
For example in functions like this suppose you want to search for add instruction with LHS sub instruction and RHS is mul instruction, you can search using LLQL like this
SELECT instruction FROM instructions WHERE m_inst(instruction, m_add(m_sub(), m_mul()))
Or for example you can query how many times this pattern exists in each function
SELECT function_name, count() FROM instructions WHERE m_inst(instruction, m_add(m_sub(), m_mul())) GROUP BY function_name
Github: https://github.com/AmrDeveloper/LLQL Currently LLQL support Ret, Br, arithmetic, ICMP, FCMP, and matchers for types and nested types. Looking forward for feedback. https://redd.it/1gh5xhu @r_cpp

BDD with C++ Hey, fellos! So I been searching how to install BDD Cucumber method in Clion and use it with C++. Is it possible? Chat gpt says yes, and provides whole all the instructions but it just doesnt work... https://redd.it/1gh32m1 @r_cpp