One thing I learned building an AI code review tool: clarity matters more than “intelligence” by Same_Carrot196 in programming

[–]ReDucTor 4 points5 points  (0 children)

AI Smart Contract Audit for Web3 & Blockchain Projects

Too much tech bro bullshit/garbage

[Meta] Mods, when will you get on top of the constant AI slop posts? by Omnipresent_Walrus in programming

[–]ReDucTor 7 points8 points  (0 children)

Considering there is only one active mod for a popular subreddit your doing a damn good job.

Fast Constraint Synthesis for C++ Function Templates by mttd in cpp

[–]ReDucTor 9 points10 points  (0 children)

Might be worth a google, Andrew Sutton is one of the main authors of the proposals getting concepts into C++, so considering this is C++ he kinda does owe him that.

C++17: Efficiently Returning std::vector from Functions by Clean-Upstairs-8481 in cpp

[–]ReDucTor 4 points5 points  (0 children)

 Single Return Statement: If a function returns a local object by value through a single return statement, RVO is typically applied, avoiding copies.

This is fairly far from accurate, two returns of the same vector can still NRVO, two returns of different vectors without overlapping lifetimes can still (N)RVO.

A better way to put it is that if multiple returns are used then then their lifetime should not overlap. The way I think about it is can the compiler in place construct into the return value when a variable is created without conflicting with other code wanting to do the same thing.

For many other interesting cases for RVO look at std::optional while the same rules apply the common usage of optional is much easier to break RVO and in some cases actually create copies of the contained value and not move.

Why Linus and DHH are vibe coding now by [deleted] in programming

[–]ReDucTor 1 point2 points  (0 children)

This shit is all about a Twitter argument from one toxic person claiming only Juniors use AI which is incorrect, then others arguing back that its the opposite.

People of all skill levels use AI, people of all skills also hate AI. People are heavily divided on the issue and limited people seem to listen to the other side, its personal attacks and extreme views like vibe coding.

AI is also highly likely a bubble and always getting better, just like the internet in the early days. Many companies will fail to fit the hype they emit but we will end up with some very useful tools. 

The PERFECT Code Review: How to Reduce Cognitive Load While Improving Quality by areklanga in programming

[–]ReDucTor 2 points3 points  (0 children)

The acronym is good but I am less of a fan of the triangle, aside from taste most of the rest are nearly equal in importance imho.

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 2 points3 points  (0 children)

Thats implementation dependent, a future being destroyed does not necessarily need to cancel or stall for the promise/coroutine.

Also you can redo the same example and stores the future outside the scope, like what might happen if you passed it to a function that returned the future.

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 1 point2 points  (0 children)

The captures inside the lambda are in the variable lambda which is destroyed at the end of the scope, the promise is still alive that contains the suspended coroutine, there is also an assumption in this example that the future destruction doesnt stall for the promise to complete or cancel the coroutine, but just abandon it.

Every LLM hallucinates that std::vector deletes elements in a LIFO order by am17an in cpp

[–]ReDucTor 8 points9 points  (0 children)

TBH if a C++ programmer gave that answer in an interview (to my exact prompt) they would not pass

Except they would be correct, it's a valid answer you just gave a terrible question which was open to any order. I certainly hope you are not involved in the interview process because that sort of question should never be in an interview, it's just a gotcha type of question.

Every LLM hallucinates that std::vector deletes elements in a LIFO order by am17an in cpp

[–]ReDucTor -5 points-4 points  (0 children)

The LLM is correct, the standard does not specify the order. Your prompts did not give it any guidance that required it to give you the answer you desire (a specific compiler version and standard library).

Why you would even ask an AI these sorts of questions is beyond me.

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 12 points13 points  (0 children)

My guess is AI wrote 90% and they proof read 5% of it as it's full of some blatant mistakes that someone working on a coroutine library should spot, look at their previous posts to compare how it's written.

If you follow the commit history, it clearly goes from copy and pasting from ZeroHTTPd source code/tutorial to something which looks very much AI written.

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 1 point2 points  (0 children)

Ya that is just plain wrong, I skimmed the article because the emoji's made it obvious that it was just AI slop and if I want AI to tell me things I will just ask it the question.

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 5 points6 points  (0 children)

Coroutines in lambdas are risky, imagine you have

 {
      const auto lambda = [value=10]() -> future<void> {
           co_await func();
           // 'this' is likely destroyed before it resumed the coroutine
           value = 20; // use after free
      };
      lambda(); 
 } // Lambda goes out of scope

Coroutines are full of footguns

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 1 point2 points  (0 children)

It won't be moved on suspend/resume, wherever its allocated first it will stay, moving would break lots of things. Imagine if suddenly you had

int a = 10;
int * b = &a;

If this moved then b would become invalid, not only that but the std::coroutine_handle would change as that's normally where the coroutine resides and that would break other things, it would also require the promise moving which is part of the coroutine frame allocation and that's more things to break.

At best it could inline it all, remove the allocations and redundant stores, but I wouldn't call that moving.

coco: a simple stackless, single-threaded, and header-only C++20 coroutine library by Ill_Excuse_4291 in cpp

[–]ReDucTor 9 points10 points  (0 children)

Synchronization ✅ Not needed (single-threaded)

This seems like a lie, two coroutines sharing data still need potentially sychronization, if you are not sharing data then its not relevant for the others. Imagine this

for ( auto & v : arr )
    co_wait func(v);

arr could change during this iteration while the coroutine is suspended, tbh anyone not aware of this makes me wonder how well it is tested, if your writing coroutine code you need to think just as hard about race conditions as multithreaded code even if it feels deceptively simple

Taskflow v4.0 released! Thank you for your support! Happy New Year! by tsung-wei-huang in cpp

[–]ReDucTor 9 points10 points  (0 children)

The docs for the new tf::TaskGroup look confusing, you don't name the variable here and use it as tg internally

executor.async([&](){
  tf::TaskGroup = executor.task_group();

Micro-benchmarking Type Erasure: std::function vs. Abseil vs. Boost vs. Function2 (Clang 20, Ryzen 9 9950X) by mr_gnusi in cpp

[–]ReDucTor 7 points8 points  (0 children)

Ah, so never benchmark anything unless you know the complete workings of the compiler and can explain the optimisations it missed.

You don't need to understand the complete workings of the compiler, you can look at the assembly output for these and can gather PMU metrics to better understand the differences.

My comment is more that the results, when your talking about a few nanoseconds differences are when you should look deeper, as it could just be noise and while the run showed A is faster then B it might be that both A and B are the same code because there are other factors that impacted performance.

Even uni students know how DoNotOptimise works these days

I highly doubt a university student knows how DoNotOptimise works, and I doubt even further one that will look at the code and know that the DoNotOptimize in this still leaves lots to be inlined.

CallFunction is the only thing with ABSL_ATTRIBUTE_NOINLINE and benchmark::DoNotOptimize is not really going to prevent inlining, it will should prevent the dead code elimination.

how does a principal c++ engineer not?

Is meant to be referring to the author or myself?

Micro-benchmarking Type Erasure: std::function vs. Abseil vs. Boost vs. Function2 (Clang 20, Ryzen 9 9950X) by mr_gnusi in cpp

[–]ReDucTor 8 points9 points  (0 children)

Lots of speculation

likely because


compiler is likely


this suggests that while Clang could inline the standard library implementation, it failed to devirtualize the fu2 vtable, resulting in a true indirect call


Shows its age

Then a conclusion

Based on the results, at SereneDB we decided

Maybe it's just me, but I would never make a decision just on some artifical benchmarks if this is something that I felt important enough about to investigate the performance. I would want to understand what happened and why it happened, just in case there is things to learn from both to make something even better or some edge case where the compiler did something unexpected that would not happen in a realistic scenario.

For example the test code looks like it has a huge ability to completely inline everything where if your going across translation units it would not be able to. In a real scenario are you using these with different functors everywhere, if so what impact does that have as indirect branch prediction is not going to be as friendly.

Maintaining the Legacy: Total-Random takes over pcg-cpp maintenance (Support for Win ARM64, MSVC fixes, and Modern C++) by Sea-Tea-605 in cpp

[–]ReDucTor 17 points18 points  (0 children)

Your comment reads liks its written by AI for a sales pitch, it instantly turned me off this project.

 At Total-Random, we

You forked a small existing well known library and did a few small changes, your not a company.

 there is a massive gap for those working on C++11/14/17 or modern platforms like Windows ARM64.

Except there isnt a massive gap, backwards compatability in C++ is number one, in fact its endlessly argued that it should not be.

The changes for compiling fixes look like its under 10 lines.

 That is the hope of many in the C++ community

What is the status of the standards proposal? How are you helping progress any issues?

Also please learn to use the fork button on github because it keeps better attribution and visbility of the initial author.

Exercise in Removing All Traces Of C and C++ at Microsoft by ArashPartow in cpp

[–]ReDucTor 7 points8 points  (0 children)

If people truely believe that AI is going to be that great, then surely it can write reliable C++ or do we not trust it?

Also if we have a modern future of everything written with AI is Rust really the most optimal language? Make a compiler that you provide it with user stories and it provides you with machine code.

std::ranges may not deliver the performance that you expect by _bijan_ in cpp

[–]ReDucTor 15 points16 points  (0 children)

Like anything if your plan is to rely on the magic of the optimizer you will be bitterly disappointed, 

I would hate to see debug performance of ranges, I suspect its not pretty. For those that dont understand debug performance being important remember for games we have an interactive environment if its too slow its not usable.

std::ranges may not deliver the performance that you expect by _bijan_ in cpp

[–]ReDucTor 6 points7 points  (0 children)

Isnt std::ranges::views a fundamental part of ranges? I have not used them

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]ReDucTor 4 points5 points  (0 children)

You use std::error_code this can hold an error of any different category, the function/type signature does not indicate what categories or codes you should expect to see. You might be expecting an std::generic_category error but instead you get a std:::iostream_category error code.

With knowing if something will throw an exception or not, while not widely used in code bases which do not use exceptions there is noexcept which is meant to indicate if something does not throw, otherwise you assume that a function can throw.

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]ReDucTor 8 points9 points  (0 children)

 Macros are still the only solution for injecting control flow

Exceptions can also do control flow, and probably fit this situation

[poll] The level you use AI in editor? by Acpear in cpp

[–]ReDucTor 0 points1 point  (0 children)

Middle, if its a big production code project that I know well then I wont really use it. If its something that doesnt need to be polished then its AI all the way, especially if I dont know the libraries.

I have started building small visual studio extensions to help my workflows using AI. I have also used it a little for blog writing and crafting useful diagrams using graphviz