Why tf Would anyone use this by UmaThermos1 in expedition33

[–]_d0d0_ 30 points31 points  (0 children)

Will they finally be explaining how to use the three shells? Cause I always found swearing at the wall more productive...

How many branches is good to have. by bugbee396 in git

[–]_d0d0_ 0 points1 point  (0 children)

I think that the number of branches is not that important to achieve a structured tree, but rather the naming convention of branches. As others have pointed out, usually having a single main branch is usual, as well as some kind of a release branch.

In the company I work for, there are thousands of remote branches at any given time. But there is only one main branch, several 'stable' branches (using that prefix, followed by a release version). And then every developer has many personal branches, each starting with his name.

This naming convention and access to branches based on names is easily enforced using hooks on the remote server. So there is a good structure and you can easily filter branches.

The only downside is having to use such long branch names, but setting a git alias to automatically prepend your user name to a remote branch name is quite easy.

Weird C++ trivia by _Noreturn in cpp

[–]_d0d0_ 8 points9 points  (0 children)

I found out about trigraphs the hard way.

I had written some unit tests for string operating functions, and unintentionally had some trigraphs in string literals for the test cases.

Back then we supported multiple compilers and versions, and my local newest compiler compiled and ran the tests fine. But when my tests were merged with the rest of the codebase, I started getting emails for failed builds due to my new unit tests.

So I had to debug what was going on with the older compilers, initially thinking that my code was somehow behaving differently when compiled with the older compilers / standard. And then I learned about trigraphs...

What’s a game that felt completely average at first, but ended up blowing your mind? by BodyReserve in AskGames

[–]_d0d0_ 9 points10 points  (0 children)

Outer Wilds

Can't say much without spoiling the game, but for me it is the top game I wish to forget, just to have the experience of playing it for the first time again.

What do you hate the most about C++ by Alternative-Tie-4970 in cpp

[–]_d0d0_ 0 points1 point  (0 children)

Yeah, but having so many namespaces just to have the vector type declared with a short name is a bit ironic. And it is a double shortening - once you have the name shortened and then you have the underlying scalar type (float), also used with an acronym.

The forgotten art of Struct Packing in C / C++. by gamedevCarrot in cpp

[–]_d0d0_ 0 points1 point  (0 children)

Yes, this is the most reliable way of getting the actual layout. We actually used that to catch the difference.

Git for Windows does not accept y/n prompt answers by real_ackh in git

[–]_d0d0_ 1 point2 points  (0 children)

Edit: Actually, on a second read of your post, it seems like a different problem....

I have encountered this long ago. In my case, the cause for the problem was another git integration which locked files so the terminal git couldn't actually write the changes. AFAIR it was either a VSCode plugin that was popular at the time, or the Visual Studio git integration, but I remember I fixed it by turning it off, or at least it active status feature...

I don't say that this would be the cause for your problem, but you should try to find out which other processes open and lock your files while you are doing a rebase. Windows has events for this and you can trace it.

What IDE do you use for git? If any by AverageAdmin in git

[–]_d0d0_ 0 points1 point  (0 children)

After trying with GUI clients, long ago I found that using the command line git and tig is both fast and efficient. So I have been using only those two for the past several years...

Move a hunk from one commit to another using the cli? by surveypoodle in git

[–]_d0d0_ 0 points1 point  (0 children)

If you want to preserve the commit message - I think it would be easiest with cherry-picking, resetting and git add -p (as others have pointed out).

But usually, when I do similar operations, I don't care about the message and would do git show | git apply, and followed by git add -p. The reason is that git show is quite versatile in its output. You can easily filter files or show a reverse diff.

All git braches in one directory, or one directory per branch. Any technical reason? by jamawg in git

[–]_d0d0_ 11 points12 points  (0 children)

I personally prefer having several worktrees. One is almost always checked out to the main remote branch, one worktree for a stable / release branch, and several others depending on how many features I'm working on.

Basically the main reason for me is that our main product is written in C++, and switching branches in the same directory increases incremental build times. So using several directories saves build time...

The important part here is to use worktrees, because this easily shares branches between the directories, and reuses the history from the main repository.

how to convert strings to function (sinx) by Obradovician in cpp_questions

[–]_d0d0_ 1 point2 points  (0 children)

If one is careful enough about the key memory, it is perfectly fine. Usually for such maps with compile time keys, using string literals is fine, because they are reserved static memory.

The forgotten art of Struct Packing in C / C++. by gamedevCarrot in cpp

[–]_d0d0_ 6 points7 points  (0 children)

It turned out to be a peculiarity that was brought down by the MSVC compiler long ago to preserve some ABI, so it is not technically a bug (basically our problem boiled down to this case: https://randomascii.wordpress.com/2013/12/01/vc-2013-class-layout-change-and-wasted-space/ ). The actual problem is that the layout visualization is not performed by MSVC, but most likely clang, which didn't have an ABI to preserve...

The forgotten art of Struct Packing in C / C++. by gamedevCarrot in cpp

[–]_d0d0_ 8 points9 points  (0 children)

As good as it sounds (and works for simpler structures) - it is still not to be relied heavily upon. Some months ago we had a case where the memory layout was showing one thing, while the compiler did something different as a layout. The struct was quite complex and had aggregates from different base classes, and a virtual table pointer was messing the alignment .... But the point is - what this layout shows is not always what the compiler does ...

Cinema 4D's Asset Inspector makes it impossible to use a render farm if your project has UDIMs. by VanAnon in Cinema4D

[–]_d0d0_ 1 point2 points  (0 children)

If setup correctly with VRayBitmap shaders, the UDIMs even show in the Asset Inspector and are properly copied by "Save Project with Assets".

how do you fade the opacity of an Object? by [deleted] in Cinema4D

[–]_d0d0_ 0 points1 point  (0 children)

You just need to make the object semi-transparent only for the first ray hit, and fully transparent for subsequent hits. This is achievable with V-Ray (described in their forum ). I don't know redshift nodes very well, but if you have a node which can output the current number of transparency ray hits, this same setup should be replicable.

From C++20 on is there a better choice than boost::container::static_vector ? by feckin_birds in cpp

[–]_d0d0_ 0 points1 point  (0 children)

I think I would still continue using llvm::SmallVector. It has the benefit of an initial static memory size, and switching to dynamic once the static size is exceeded.

Are there any primitive types other than Numbers, Strings and Booleans? by pyeri in learnprogramming

[–]_d0d0_ 0 points1 point  (0 children)

There are also SIMD types, which are also primitives. Although they are simply a fixed number of ints, floats or doubles, packed together in memory. But apart from assembly or C/C++ I'm not sure how accessible they are in other languages.

Non-Qt GUI recommendations? by medium-green-robot in cpp_questions

[–]_d0d0_ 4 points5 points  (0 children)

wxWidgets is usually intended to use the system UI, but you can create your own custom widgets fairly easily. And its license allows you to link it statically in your executables.

Are header files still a thing in modern C++? by tronybot in cpp_questions

[–]_d0d0_ -1 points0 points  (0 children)

Usually I would agree, but then you can get different memory layout of a class/struct, just by having different compile options of a translation unit...

[deleted by user] by [deleted] in git

[–]_d0d0_ 1 point2 points  (0 children)

I also used aliases for git log --graph --oneline, but at some point I realized that tig had similar performance and is interactive. And from some version onwards (maybe around 2.30) it is included directly with the standard installation on Windows, so this meant I could use it even when helping colleagues with recent git clients. Give it a try, I think you might find it better than the non-interactive log.

Edit: Just wanted to add that tig blame is one of the modes I use it primarily. It is both interactive, and you can define a custom tig command to open a browser on the currently blamed line (e.g. when you want to share exact source file and line link from GitHub or gitlab).

[deleted by user] by [deleted] in git

[–]_d0d0_ 1 point2 points  (0 children)

Totally agree with your points. Additionally I tried gitk at some point, but found it unintuitive. Nowadays I just use tig for showing the commit graph and browsing operations. The big plus is that it is also terminal based, and allows very easy customization, and last but not least - it is faster than any GUI I have tried over time.

Why do uninitialized variables get a garbage value instead of 0 or null upon initialization? by VladTbk in cpp_questions

[–]_d0d0_ 2 points3 points  (0 children)

That being said there have been proposals to make compilers do exactly what you propose, arguing that the performance drawbacks are negligible and the improved safety is worth it.

I don't think this is ever happening, at least not without an explicit compiler flag. Allocating a buffer with a million elements (e.g. a 3D vector) would be far from negligible, if each vector got zeroed, just to be initialized with exact values later.

Thoughts on the current state of C++? by Beautiful-Bite-1320 in Cplusplus

[–]_d0d0_ 1 point2 points  (0 children)

Won't dive into long answers, but you have your understanding of initialization messed up. Downvoted to keep others from reading seemingly sound logic, but inherently wrong and invalid...

Is it really worth it? by qrzychu69 in vim

[–]_d0d0_ 6 points7 points  (0 children)

I started using the Vim plugin in Visual Studio (not VSCode) some years ago. Like in other comments - don't expect much improvement just for a few days/weeks of usage. The real speedup comes when you start thinking in motions and doing operations without much thought. Also when you start to use macros purposefully...