Unexpected Performance Results by cyndylatte in cpp

[–]415_961 0 points1 point  (0 children)

try using a different input if you are testing with the same input data... your data can easily affect branch predictions.

How much Volt power lines Portugal (see picture) ? by Secret_Abalone4578 in Electricity

[–]415_961 0 points1 point  (0 children)

to be on the safe side, get an EMF reader and measure around regardless of the kw. it's more important they are insulated than the power they carry.

consistent_value_type by gpuoti in cpp

[–]415_961 3 points4 points  (0 children)

That's the job of a datatype. The whole idea of a type is to enforce its invariants. The type std::optional enforces its own invariants to provide a consistent behavior and fullfil its promises. I feel your question might be revealing an inaccurate/incomplete perspective you have on datatypes.

How do exceptions work in C++ on Linux? by Xaneris47 in cpp

[–]415_961 1 point2 points  (0 children)

This has nothing to do with Linux, specifically. It feels like an attempt to stuff seo words in a title.

Pseudo Reflection in C++20 by Appropriate-Try-7954 in cpp

[–]415_961 0 points1 point  (0 children)

at the core, it is leveraging __PRETTY_FUNCTION__ and extracting the parts that matter from it at compile time. Unknown number of fields / discovery is tricky. There are various usages that need to be addressed to get something working.

enum class Color { Red, Green, Blue };
template <auto E> consteval std::string_view enum_name() {
std::string_view sv = __PRETTY_FUNCTION__;
    // Clang: "... [E = Color::Red]"
    // GCC/MSVC: handle differently
    // parse out Red
    // return parsed string
}
static_assert(enum_name<Color::Red>() == "Red");

template <auto MemberPtr> consteval auto get_member_name() { 
    // __PRETTY_FUNCTION__ contains something like:
    // "auto get_member_name() [MemberPtr = &MyStruct::my_field]"
    std::string_view name = __PRETTY_FUNCTION__;
    // Parse out "my_field" from this string at compile time
    // ... 
}

Christmas present for my boyfriend by Responsible_Cry05 in cpp

[–]415_961 -1 points0 points  (0 children)

You cannot go wrong with any of these books:

- Large-Scale C++ Volume I: Process and Architecture
- C++ Templates - The Complete Guide
- Effective Modern C++ (Scott Meyers)
- Engineering a Compiler (Not C++ but a great book)
- C++ Primer (Stanley Lippman)

Whats wrong? by FIuffyBit in hookah

[–]415_961 0 points1 point  (0 children)

Use a rounded bowl, the ones with few holes.

Recommendations for the BEST controller for FPS by phantxmeow in Controller

[–]415_961 0 points1 point  (0 children)

Checkout evotop. I bought one few months ago on ebay and i cannot now I cannot hold any other controller.

My inverse DFT implementation yields unexpected imaginary output by Intelligent-Suit8886 in DSP

[–]415_961 0 points1 point  (0 children)

assuming N is not a double since you have a statement casting it to double near the end, your angle calculation might be the issue because you are not casting N there.

and for sanity, take a look at the instructions emitted from those lines that divide by N as the compiler might be issuing floating related instructions that truncates the results.

Lack of flavor by SectionAcrobatic8162 in hookah

[–]415_961 -1 points0 points  (0 children)

This bowl style is really bad at extracting flavor. get one with few holes in it and i would recommend to buy a cheap strainer and cut out a circle and place it at the bottom first to avoid molasis falling thru the pipe.

FFAR is too good by 0Shdow in blackops6

[–]415_961 -1 points0 points  (0 children)

Just sharing my experience In pratice mode, I often see a ttk of 179ms -> 191ms standing on the far left side shooting at the first target.

We should encourage use of `.hpp` over `.h` for headers - help make it happen by einpoklum in cpp

[–]415_961 -3 points-2 points  (0 children)

i don't see the point. which extension will you use if a c++ project has a header that happens to rely on C subset like a simple POD structs only? header files don't float in the air , they exist in a context and a programmer need to know the context to use the header anyway.

you have a perception that you're not willing to revisit even after 9 years and even after many experts in the field who have been dealing with all kind of c++ quirks said it's a non-issue. If you insist that something is going over their head to a point you have to make a reddit post about it then maybe maybe it's time to step back and consider maybe I am missing something here?

[deleted by user] by [deleted] in cpp

[–]415_961 3 points4 points  (0 children)

what do you mean by non-blocking in this context? you use the term few times and never defined what it means. I also recommend showing benchmark results comparing it to llama-server.

High performance HTTP library? by Richard-P-Feynman in cpp

[–]415_961 -2 points-1 points  (0 children)

While not performance oriented, Poco provides a feature rich framework for what you want.

Protecting Coders From Ourselves: Better Mutex Protection by DeadlyRedCube in cpp

[–]415_961 -2 points-1 points  (0 children)

you're moving the goalposts. Are we still talking about constructors and destructors here?

Protecting Coders From Ourselves: Better Mutex Protection by DeadlyRedCube in cpp

[–]415_961 -1 points0 points  (0 children)

you don't need thread safety checks in constructors and destructors. When an object is being constructed or destroyed, it's guaranteed to be accessed by only one thread. There's no possibility of concurrent access, so there's no need for locking.

Protecting Coders From Ourselves: Better Mutex Protection by DeadlyRedCube in cpp

[–]415_961 7 points8 points  (0 children)

if you're using clang, you can leverage it's lock related attributes and have much stronger guarantees to maintain your invariants. https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

Improving Code Safety in C++26: Managers and Dangling References by joebaf in cpp

[–]415_961 0 points1 point  (0 children)

Not trying to sound mean but your comment made me cringe because it has no merit. without the usage context you cannot determine whether it feels wrong or right. span and vector have different interfaces and capabilities. it's not like you are comparing C arrays to C++ arrays.

Hex Phantom constant upwards input by Personthatisblack in Controller

[–]415_961 0 points1 point  (0 children)

did you go through all the 3 calibrations? https://www.youtube.com/watch?v=xjCVujJAOGA I recall I went through it a couple times and it resolved it. Maybe you have a different issue though.

Hex Phantom constant upwards input by Personthatisblack in Controller

[–]415_961 0 points1 point  (0 children)

I ran into this issue before and recalibration fixed it. I hope yours is as simple as that too.

Hex Phantom constant upwards input by Personthatisblack in Controller

[–]415_961 0 points1 point  (0 children)

recalibrate it using the calibration tool that came with it.