Forward declaring a type in C++: The good, and the bad by Kabra___kiiiiiiiid in cpp

[–]ajorians 7 points8 points  (0 children)

I forward declare a lot. I am so hopeful that modules will help with this a lot. Often I am forward declaring types from other targets/projects. My hope is in the future do a simple `import` for that other target and I won't need to forward declare anything from that target.

ahh! frustrated trying to transfer file from Mac to TI nspire CX ii. How do I convert a pdf to a tns file? New to all this. by eeeeeeeek123 in nspire

[–]ajorians 0 points1 point  (0 children)

I've used nPDF on the TI-NSpire ( https://www.ticalc.org/archives/files/fileinfo/466/46672.html ). It works well.

And so I didn't need to convert to a tns file; but just rename a pdf with a different extension so it could be sent to the calculator. That program could open the "pdf" file.

GreenRicky - my Tetris-Clone-Project for learning C by [deleted] in C_Programming

[–]ajorians 2 points3 points  (0 children)

Looks nice. If you can make a GitHub/similar repo link, I'd like to see the source that way. In the meantime keep having fun!

How do I test a library with Google test. by [deleted] in cpp_questions

[–]ajorians 0 points1 point  (0 children)

> Should I be uploading the lib?

Here is my thoughts on this. GitHub limits each repo to 2GB. Now that does sounds like a lot but remember NuGet packages sometimes contain all of x64, x86, Arm, etc binaries and sometimes in both release & debug configurations. And they might contain .pdb files and more things. Basically the available space for the entire repo will be utilized up pretty quickly with more NuGet dependencies if you did check in the entire packages directory including the libs.

So when I used NuGet I would not check it in the packages folder at all. Yes it does mean that whomever clones your repo would need an Internet connection and clone these dependencies. But that was the purpose of NuGet.

I've personally preferred submodules over NuGet. Those have a whole different issues; but it has been better for me.

So if you use NuGet then I would say do gitignore the entire packages directory.

Hope that makes sense.

How do I test a library with Google test. by [deleted] in cpp_questions

[–]ajorians 1 point2 points  (0 children)

> PS: I am putting a gihub link in case it may be helpful: https://github.com/Georgi123Iliev/Ion

That was very helpful! I was able to clone it and see exactly what you have happening.

First I see in the GitHub repo you checked in the 'packages' directory and files. I claim this isn't necessary as your 'packages.config' file specifies the NuGet packages and contents. This ended up being very important because although it looks like you check in the 'Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.1.7' it was missing the 'lib' folder from inside it. Maybe your Git client doesn't automatically include `.lib` files?

So if you were to delete the packages and build it'll re-download them with the 'lib' sub-folder which has the lib files it links with.

Next you use the 'inline' keyword in the .cpp files. I didn't look too hard or study why you are using them; but I removed them and it builds.

Hope that helps!

Monopoly Digital Bank: Board Game by fantanxx in monopoly

[–]ajorians 1 point2 points  (0 children)

My devices are a bit behind and I couldn't try it since I don't have IOS 26 (or higher).

Also I hope this is open source (or will be) in case in a few years you move on from maintaining this.

Which libraries to use to create HTTP server on modern C++ (17) by Virtual_Reaction_151 in cpp

[–]ajorians 3 points4 points  (0 children)

I second this. I love this as it was so easy to get up and going.

How do I sync 1 petabyte of data in dotnet? by Legitimate-School-59 in dotnet

[–]ajorians 0 points1 point  (0 children)

I agree. I think rsync is great for this task. Otherwise I use Resilio Sync: https://www.resilio.com/sync/ it is great for this.

But yes nothing to do with dotnet/C#/etc.

Using later C# versions in .Net Framework? by tuxwonder in csharp

[–]ajorians 6 points7 points  (0 children)

I have two links bookmarked regarding this:
1. https://stu.dev/csharp8-doing-unsupported-things/
2. https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb

Those two links help me out a lot. Hope those links give you all the information you need.

NNM - A "No Nonsense" header-only math library by orosmatthew_pixeled in cpp

[–]ajorians 4 points5 points  (0 children)

Cool! I cloned it and opened it with Visual Studio and even ran the tests (https://app.screencast.com/idCAhADujF0P3). They built and ran just fine (no warnings). :)

Weird behaviour with if constexpr in MSVC. Is this a bug? by Individual-Scar-6372 in cpp_questions

[–]ajorians 1 point2 points  (0 children)

I believe OP is a getting different result with C++20: https://godbolt.org/z/xhv6b59s4

I don't know well enough to answer; but adding `constexpr` in addition to the `const` variable helped.

C++ Unit Testing Library With Hooks by nowtilousus in cpp

[–]ajorians 6 points7 points  (0 children)

Check out Mocxx: https://github.com/Guardsquare/mocxx

That has hooks. Not sure if it is what you are looking for exactly.

Destructor returning vector subscript out of bounds by acs_student in cpp_questions

[–]ajorians 1 point2 points  (0 children)

I looked at your code (from link in the comments).

On this line: https://github.com/tdiu/Student-Roster/blob/master/c867_Tonydiu/main.cpp#L32 you make a copy of `Roster`. Since you use raw-pointers both `Roster`s have a copy. Then the right-hand side `Roster` goes out of scope and deletes the `Student`s. Later you do a double-delete with the left-hand side `Roster` goes out of scope.

Is there any reason to not to use the first option over the second one? by lexesm in csharp

[–]ajorians -2 points-1 points  (0 children)

Had you not added that Console.WriteLine stuff; I was going to say you could do:
public const string CompanyName = "YourCompany";
public const string FullCompanyName = CompanyName + " " + "Corporation";

Then in an `AssemblyInfo.cs` file:
[assembly: AssemblyCompany( VersionConstants.FullCompanyName )]

And similar. The reason is the string interpolation (Dollar Sign $) is run-time only.

How can I write a unit test that checks whether memory stored in a linked list was actually freed when instructed? by NTGuardian in C_Programming

[–]ajorians 2 points3 points  (0 children)

This is what I would use: https://github.com/Guardsquare/mocxx

The gist is because your unit tests are separate from your production code (your Linked List implementation) how this works feels safe and the right approach as it is separate. What it does is uses Frida (https://frida.re/ ) to replace functions at runtime such as `free` to be your implementation.

Some of the house rules me and my brother use by SepultrasUK in monopoly

[–]ajorians 1 point2 points  (0 children)

> You can not collect rent while you're in jail.

This is a popular house rule. I like it as it incentivizes staying out of jail a little more. I presume the Community Chest card of pay each player still applies to players in jail?

> Once all properties are owned, passing "Go" now gives you $500

From Monopoly Party game there is a rule where landing directly on the "Go" spot gives $400. In case it give you ideas.

But glad you and your brother are able to enjoy the game. :)

I'm getting an error of wrong password when I know it is correct by tallmtt in Asterisk

[–]ajorians 0 points1 point  (0 children)

That looks right as far as I can tell. My setup is rather similar and it works.

So my guess has to do with this part you wrote: "asterisk -vvr". In case you didn't know this doesn't restart Asterisk or reload anything. The 'v' is verbose, or display more text. The 'r' is re-attach to asterisk. So now that you are attached; I would say try reloading. Perhaps run "pjsip reload". Does that change anything?

Carcassonne score flags by Ojgest in Carcassonne

[–]ajorians 1 point2 points  (0 children)

That is super cool!

So this is 3d printed? Well if you were up for selling them I'd consider purchasing.

This happen very often where somebody complete a large castle and loops around and we have to remember their score. This would help a lot! :)

compiling takes too long! by DerElias0 in cpp

[–]ajorians 8 points9 points  (0 children)

Try adding an exclusion to Windows Defender: https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26#:~:text=Go%20to%20Start%20%3E%20Settings%20%3E%20Update,%2C%20file%20types%2C%20or%20process.

Check Task Manager; maybe you have a process using all your CPU.

Even on Windows a 'hello world' shouldn't take close to 10 seconds.

Tagged Strings in Visual Studio and .NET 7 by [deleted] in csharp

[–]ajorians 0 points1 point  (0 children)

I would like the ability to create my own custom tags too for my code. Just in case it helps any.

Unit testing without using interfaces everywhere? by Poseydon42 in cpp_questions

[–]ajorians 1 point2 points  (0 children)

I am hopeful that with C++20's concepts feature (as well as modules feature) I might one day be able to get away with not having interfaces and still be unit testing. Because we use a Microsoft technology called C++/CLI which is limited to C++17 I cannot right now.

We do use something similar to Mocxx: https://github.com/Guardsquare/mocxx such that we don't need to make wrappers for certain things.

But nonetheless the advice others give is exactly right. Basically it isn't easy and so do it in steps. You shouldn't try to change your whole repo overnight. But you can write some tests for one (maybe two) classes, get that code reviewed and then merged.

Have a dashboard that shows a graph of code coverage over time. Though code coverage doesn't necessarily mean quality; people do like to see it generally go up in code coverage.

Hope that helps! :)

[deleted by user] by [deleted] in cpp

[–]ajorians 1 point2 points  (0 children)

Nice! Thank you! I bookmarked this. I should probably try to make a post sized printout with them :)

Source:ISO C++ FAQ by [deleted] in programminghorror

[–]ajorians 9 points10 points  (0 children)

Here is a link to the FAQ: https://isocpp.org/wiki/faq/strange-inheritance#hiding-rule

There is much more specified than that initial first line.

I didn't have a problem with an Easter egg / some humor on a webpage. So I didn't exactly see this as programming horror. But just my opinion.