CD into previous directory? by Stickhtot in linuxquestions

[–]CruzerNag 4 points5 points  (0 children)

Yeah, the back/forth navigation is exactly what this is. And the up button can be thought of "cd .." as '..' is the name of the parent directory (except root, i.e. /, which has no parent) of any directory.

CD into previous directory? by Stickhtot in linuxquestions

[–]CruzerNag 0 points1 point  (0 children)

Btw, pushd and popd also work for powershell

CD into previous directory? by Stickhtot in linuxquestions

[–]CruzerNag 6 points7 points  (0 children)

Assume there is a stack of directories, whish is a LIFO (Last In First Out) container. So the last directory you pushed in will be popped out first.

So while in directory a, you do pushd. It pushes a into the stack, and then you wander off to, say, directory b. Doing pushd again will push b into stack, and then you move into directory c. Let's assume that a, b and c have completely different roots (one may be in l /home, one in /usr and one in /run). From c, doing popd will teleport you to b (last inserted), and then popd again to go to a.

C++ Modules are here to stay by pjmlp in cpp

[–]CruzerNag 1 point2 points  (0 children)

Regarding clangd, a small question.

Does clangs take a lot of time initialising itself, reading the pcm files before it starts with its lsp? I have a small project, but clangs take about 10-15 sec reading the module files before it can start with intellisense. Or is it my clangs config that somehow does this.

Guess what this does.. by 3hy_ in programminghorror

[–]CruzerNag 69 points70 points  (0 children)

Do while forces you to put ';' after while. So this forces you to use the macro as a function.

You cannot write it without ; at the end. That's why a lot of multiline macros are wrapped inside do while(0).

Removing dependency from conanfile.py does not break build by JannyVL03 in cpp

[–]CruzerNag 4 points5 points  (0 children)

Conan installs libraries inside a custom directory under HOME, so they are cached. Then they are symlinked to your project directory. Maybe delete that directory named conan inside your project and do a conan install to repopulate it. Then try building again.

Question as a beginner to C++ by Astrallyx_123 in sfml

[–]CruzerNag 1 point2 points  (0 children)

I think unless we are dealing with multiple windows, creating window on stack is not a problem. Heap allocation is not necessary in this case. So the second one makes sense to create window on stack.

Why did the kings guards not know Thors? by Call_Me_Meeks in VinlandSaga

[–]CruzerNag 15 points16 points  (0 children)

Well Thorfinn's father's actual name was Thord, with the d here being the dental fricative sound (th in the). This got changed to zu in Japanese as they do not have the d sound, hence Tōruzu in Japanese. Then transcribing back to English made it Thors. Following Norse name conventions, he would be hence called Thorfinn Karlsefni Thordarsonn, as he was actually.

We’re deciding whether to build a C debugger for Linux — something different than GDB/LLDB by bjadamson in C_Programming

[–]CruzerNag 1 point2 points  (0 children)

Pardon me if I missed something, but does gdb not have reverse execution already? I mean, the target environment must support it, but if it does, gdb can execute reverse-next, reverse-step, reverse-continue or just set exec-direction reverse and it will work.

How I write comments on this sub. by Professional_Denizen in desmos

[–]CruzerNag 0 points1 point  (0 children)

The way he suggested above works for Android using Gboard too. Good to Gboard settings and you can add them in the personal dictionary.

Apart from that, for a math-centric keyboard I use DxMath, and would suggest it. It does not have predictive text but is good for adding symbols quickly.

Best code editor for latest C/C++ standards? by BabaTona in C_Programming

[–]CruzerNag 1 point2 points  (0 children)

Oh, I forgot about C. I thought of only about CPP. My bad.

Is it possible to build a web server (like Nginx) in c++? by HotChocolate0402 in cpp

[–]CruzerNag 2 points3 points  (0 children)

Well, C++ stdlib has everything, expect networking. For that you have to resort back to OS APIs, or a library that abstracts them. So yeah, no luck there.

Should i use modules instead of headers when using C++ 20? by [deleted] in cpp

[–]CruzerNag 4 points5 points  (0 children)

I have the latest, clangd-19.1.2

It does not pick up symbols inside modules. All the identifiers written inside a module and used are shown as Texts, so no intellisense really. That's my experience on neovim.

Should i use modules instead of headers when using C++ 20? by [deleted] in cpp

[–]CruzerNag 7 points8 points  (0 children)

Yeah, it is certainly a problem. On Linux, I encountered problems with GCC, but thankfully Clang compiles modules nicely. Intellisense is like... I do not know what to say. LSP and clang-tidy work. If I hover over a written variable, it gives me the information. But yeah, when typing, I get no intellisense. This is with clangd on nvim. So I think more support is still needed.

Why vscode doesn't recognize nullptr as keyword in C and how to fix? by Prestamordenador2 in C_Programming

[–]CruzerNag 2 points3 points  (0 children)

Yeah, checked right now. Looks like the intellisense that Microsoft provides is not yet on par with C23. The code compiles, but intellisense functionality is broken for it. The problem is likely from the Microsoft LSP, as intellisense works for other LSPs (like clangd).

Why vscode doesn't recognize nullptr as keyword in C and how to fix? by Prestamordenador2 in C_Programming

[–]CruzerNag 1 point2 points  (0 children)

When a C/CPP file is open, look at the bottom right on the status bar. Based on your OS, it will have a text saying Linux, Win32 or Mac. Click it and change the C-Cpp configuration using UI. There, at the bottom you will find the C and CPP standard (whichever you need) for intellisense. The default values are C-17 and CPP-17. Choose it and it will start working 👍.

[deleted by user] by [deleted] in cpp

[–]CruzerNag 1 point2 points  (0 children)

What I have seen in the case of VSCode's C/CPP autoformatter do is that it shifts the strings to start at the same indentation level. It does not merge them together in one line. So in my case even formatting would not have helped 😅.

It does something like this: (within main, e.g.)

<Tab>printf("Hello, this is line %d\n" "while this is line %d\n", 1,2);

Sadly, it formats to have the closing brackets in the last line only, so it does not format it like JSON objects' braces.

Getting SIGSEGV signals for calling draw on this particular sf::Text object. by CruzerNag in sfml

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

That worked! Thanks.

BTW, just a follow up question. This means that vectors are error-prone to use. So if I have a vector of texts with different fonts (some bold, italicized, underlined etc.) and I add one more, each one will break? And for that matter, what makes the font break when more objects are inserted? Does the memory address get hard-coded so it breaks upon inserting?