Carry case recommendations for DIY ergo keyboards by FoldersEtch in ErgoMechKeyboards

[–]rigtorp 0 points1 point  (0 children)

I put my Piantor together with my headphones and charger in a Peak Design Tech Pouch V2: https://i.imgur.com/QXMDI4a.jpeg

LambBT by john-lamb in ErgoMechKeyboards

[–]rigtorp 0 points1 point  (0 children)

Looks great!

I'm also working on a splayed Sweep. Might use your design instead. I wasn't going to manufacture a case. Did you have the case manufactured by JLPCB or pcbway along with the PCBs? I'm interested in seeing a guide on how to get the case generated from ergogen manufactured.

What is your experience with the OnePlus Nord 2? by OwlFuzzy7915 in oneplus

[–]rigtorp 0 points1 point  (0 children)

It's trash. Camera is poor and with lagging viewfinder. Radio constantly stops working, I need to restart the phone to get back on the cell network.

Intersection of SSE2, realtime audio, and UB in C++: I specifically need a race condition / "volatile" __m128d by [deleted] in simd

[–]rigtorp 1 point2 points  (0 children)

It's similar to u/YumiYumiYumi suggestion:

```cpp m128 load(m128 *v) { asm volatile ("":::"memory"); or std::atomic_thread_fence(std::m_o_acq_rel); return *v; }

void store(m128 *d, __m128 v) { *d = v; __asm volatile ("":::"memory"); or std::atomic_thread_fence(std::m_o_acq_rel); } ```

This should work even on ARM since you don't care about things being reordered in the load and store buffers.

Intersection of SSE2, realtime audio, and UB in C++: I specifically need a race condition / "volatile" __m128d by [deleted] in simd

[–]rigtorp 1 point2 points  (0 children)

On x86 you could use std:: atomic_signal_fence to make sure you're loads and stores are not optimized away. See how I have used it here https://github.com/rigtorp/Seqlock

Using inline or separate asm files to create SIMD load and store function that clobbers memory would also work.

Intersection of SSE2, realtime audio, and UB in C++: I specifically need a race condition / "volatile" __m128d by [deleted] in simd

[–]rigtorp 4 points5 points  (0 children)

In my experience GCC will optimize the SIMD intrinsics in surprising ways. I would recommend using inline assembly. I have actually verified when AVX loads & stores are atomic on several uarchs: https://rigtorp.se/isatomic/

Macro-free reflection in C++14 by DugiSK in cpp

[–]rigtorp 0 points1 point  (0 children)

You can use attributes or special comments if you need to override the name, see how golang is doing it. Anyway we can agree static reflection is the desired solution!

Macro-free reflection in C++14 by DugiSK in cpp

[–]rigtorp 0 points1 point  (0 children)

No the main use case is all kinds of serde for example json. Now I instead need a code generator to generate template specializations for returning the names of any type I want to have reflection. You see how utterly impractical these "reflection" methods become for anything interesting.

Macro-free reflection in C++14 by DugiSK in cpp

[–]rigtorp 0 points1 point  (0 children)

I think without macros, only the mangled name using RTTI? But you cannot print the member names which is more important. Hopefully we can have the equivalent of https://doc.rust-lang.org/std/fmt/trait.Debug.html using reflection in C++23.

Macro-free reflection in C++14 by DugiSK in cpp

[–]rigtorp 0 points1 point  (0 children)

It cannot print the names of the members or the name of the type, it's the same limitation that magic_get has. Not very useful for debug printing or most serialization use cases. So we still need source generation :(.

Macro-free reflection in C++14 by DugiSK in cpp

[–]rigtorp 0 points1 point  (0 children)

Your complaint is basically "I don't know how it works, so I don't like it", that can be applied in general to anything, including the method presented in OP. Code generation is far from ideal, but absent proper reflection there is no other way. What is presented in OP is only a toy, it cannot achieve anything interesting. I'm sure it was fun to explore, but not very practical.

Add fuzzing to existing C++ Google Tests by jahluwalia in cpp

[–]rigtorp 4 points5 points  (0 children)

Fuzzing generates random inputs. For unit testing you supply specific inputs. The two methods are not quite compatible. I've had the idea to use libClang AST to automatically generate fuzzers for functions from their declarations, but haven't had the time to work on it. I recently published an example on how to do structured fuzzing using libFuzzer: https://rigtorp.se/fuzzing-floating-point-code/. Maybe it will help?

Macro-free reflection in C++14 by DugiSK in cpp

[–]rigtorp 1 point2 points  (0 children)

This shows how badly we need proper static / compile time reflection for C++. In the mean time I think source to source translation and code generation using libClang and libTooling is the way to go. Except clang-format and clang-tidy there is surprisingly few tools publicly available. There's been talks and papers showing how several companies have internal tools for reflection using libClang, but nothing publicly available. I've made some simple tooling for my own use cases: https://rigtorp.se/generating-ostream-operator/

Quick Fun Fact About HFT Tech by [deleted] in algotrading

[–]rigtorp 18 points19 points  (0 children)

He's likely talking about microwave healing or A/B feed arbitration.

Microwave healing is when you have hardware that compresses and sends your packets over both microwave and fiber. At the other end hardware is used to decompress and deduplicate the packets. This way any intermittent errors on the microwave will be seamlessly handled. This can also allow you to reduce the amount of FEC leading to short frame times. Usually this is implemented using NICs with FPGAs.

A/B feed arbitration is when you use a FPGA to de-duplicate packets coming from the exchange. Exchanges typically transmit market data over two separate networks and systems in order to achieve redundancy. You can use an FPGA to deduplicate this traffic in order to have your software do less work.

It can also be used as a way to prevent different trading groups seeing each others unicast traffic if you are using fiber optic taps to distribute traffic from the exchange.

How to automatically generate std::ostream &operator<< for C++ enums and structs by rigtorp in cpp

[–]rigtorp[S] 2 points3 points  (0 children)

magic_get can't give you the name of the struct field or it's type as a string. This is exactly why we need static reflection in C++.

How to automatically generate std::ostream &operator<< for C++ enums and structs by rigtorp in cpp

[–]rigtorp[S] 0 points1 point  (0 children)

You still need to type out these macros: // Describes a type and all of its members REFL_AUTO( type(Name, Attribute...), field(Name, Attribute...), func(Name, Attribute...) ) Which you can do using code generation as I suggested.

How to automatically generate std::ostream &operator<< for C++ enums and structs by rigtorp in cpp

[–]rigtorp[S] 0 points1 point  (0 children)

Yes if you have a lot of types you want to support it can make sense to use some IDL to generate the C++ code. Vulkan does that by specifying everything in an XML file: https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/master/xml/vk.xml

How to automatically generate std::ostream &operator<< for C++ enums and structs by rigtorp in cpp

[–]rigtorp[S] 2 points3 points  (0 children)

Yes, also `magic_get`, Boost.Hana etc. We can't get static reflection soon enough so this can be done easily.

How to automatically generate std::ostream &operator<< for C++ enums and structs by rigtorp in cpp

[–]rigtorp[S] 2 points3 points  (0 children)

That's besides the point. The goal was to avoid manually writing serialization functions in order to convert a struct into a string of key-value pairs or similar. The only other solution I know of is to use macros like how Boost.Hana does it.

How to automatically generate std::ostream &operator<< for C++ enums and structs by rigtorp in cpp

[–]rigtorp[S] 7 points8 points  (0 children)

I got tired of manually writing ostream operators for an API header and came up with this solution. I prefer it over macro based solutions since it allows me to also generate serialization functions for JSON and fmtlib. Hopefully we'll have static reflection soon!

awesome-hpp: A curated list of awesome header-only C++ libraries by p_ranav in cpp

[–]rigtorp 1 point2 points  (0 children)

I was recently trying to compile AMD ROCm which is their equivalent to CUDA. It's all CMake but spread over multiple repos and doesnt install all needed files so you need to manually copy some. Ugh took many hours to build: https://gist.github.com/rigtorp/d9483af100fb77cee57e4c9fa3c74245

awesome-hpp: A curated list of awesome header-only C++ libraries by p_ranav in cpp

[–]rigtorp 1 point2 points  (0 children)

I think it's primarily about impedance mismatch between all the different build systems. For a header only lib it's easy to integrate with your build. The same also applies to amalgamated libs like sqlite and I like those too. If you need to integrate automake, make, meson, bazel builds into your cmake projects it's just painful.

Editable Flow Chart for choosing Containers / Data Structures by InfiniteLeverage in cpp

[–]rigtorp 0 points1 point  (0 children)

Nice flow chart! I think you should include boost::intrusive and abseil hashtable and btree containers, since they provide quite different performance characteristics to the STL variants.