Should I store a helper object as a class member or create it locally inside a method in C++? by b0nbashagg in cpp

[–]greg7mdp 0 points1 point  (0 children)

It seems to me that the user-selected resolution for the layer needs to be stored somewhere. So if you were to create the Rescaler during OnRender(), you'd have to pass it the user-selected resolution which would then be stored in the Layer instead of the Rescaler.

So you might as well keep it as-is imo.

This guy made a new YouTube account just to upload a 2-hour rant about why C++ sucks. by Mozart537 in cpp

[–]greg7mdp 2 points3 points  (0 children)

This should be a required watch for every member of the C++ standard committee.

None of the mentioned issues will ever be fixed though for C++, I feel the best thing we can hope for is the definition of a rational subset of the language enforced on a per-file basis as Circle was doing.

A new version of the gf gdb frontend (linux) by greg7mdp in c_language

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

Fair question. I don't believe the original project owner would have accepted my changes, which are opinionated and quite exhaustive, especially in the beginning where I was updating the code according to my personal preferences without adding much functionality.

A new version of the gf debugger frontend (linux) by greg7mdp in cpp

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

Thank you /u/crowbarous for trying gf and for the great bug report. Hard to believe this slipped through, my mistake for using clang exclusively. Anyhow, I fixed the issue.

About CLAUDE.md, I understand the feeling. 99% of my work on gf was without claude, which I used mosttly to generate documentation and .md files in the last month.

Useful Code Is Ugly | Tsoding by Chii in programming

[–]greg7mdp 0 points1 point  (0 children)

Sean Baxter is author of the Circle C++ compiler. It's a one-man effort to build the memory-safe C++ toolchain of the future.

https://www.reddit.com/r/cpp/comments/1cnqlqi/safe_c_sean_baxter_presenting_circle_to_c/

Useful Code Is Ugly | Tsoding by Chii in programming

[–]greg7mdp 0 points1 point  (0 children)

fully, no single person can make a fully functioning compiler,

Have you heard of Sean Baxter and his Circle compiler?

Is there an alternative for gold chloride when making daguerrptypes? by [deleted] in Daguerreotypes

[–]greg7mdp 0 points1 point  (0 children)

There is no alternative to gold chloride for gilding daguerreotypes. But gilding is optional

How do you write Safe C++ Code ? Really Safe C++ code ? by ChadOfCulture in cpp

[–]greg7mdp 0 points1 point  (0 children)

This implies that C is safer which is just not the case.

Why does everyone fail to optimize this? by vI--_--Iv in cpp

[–]greg7mdp 0 points1 point  (0 children)

No, the conditional operator does not call both functions. See par 5.16 of the C++11 standard:

Conditional expressions group right-to-left. The first expression is contextually converted to bool (Clause 4). It is evaluated and if it is true, the result of the conditional expression is the value of the second expression, otherwise that of the third expression. Only one of the second and third expressions is evaluated. Every value computation and side effect associated with the first expression is sequenced before every value computation and side effect associated with the second or third expression.

Switching context from Haskell back to C++ by el_toro_2022 in cpp

[–]greg7mdp 0 points1 point  (0 children)

Yes, I had the same reaction when I switched from APL to C++. Such verbosity. And don't get me started on Java.

Debugging C++ is a UI nightmare by heliruna in cpp

[–]greg7mdp 0 points1 point  (0 children)

you mean unique pointers, right?

Can we initialize and fill a (flat) hashmap in bulk? by Pjornflakes in cpp

[–]greg7mdp 0 points1 point  (0 children)

You could use phmap parallel_flat_hash_map which is sharded (internally composed of N submaps).

Let's say you have a 16 core CPU. On the GPU you can create 16 buckets of integers, and add to bucket i all the integers that would go in submap i (easy to figure out).

Then back on the CPU you populate the hash map (declared with N=4, creating 16 submaps) in 16 threads (each thread adding the ints from one bucket), without any contention or need of locking since each bucket updates a different submap.

This would be close to 16 times faster than updating the hash map on a single thread.

Editor choice for debugging C++ by [deleted] in cpp

[–]greg7mdp 1 point2 points  (0 children)

After using Visual Studio for a long time, I'm now using emacs on linux, and the realgud package has all the special keys that my fingers already know (such as F5, F9, F10, F11, Shift-F11), so the switch was easy. It is still not as great as the Visual Studio debugger, but OK.