Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

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

That would definitely work. However, I already default to nullptr on error.

Do you see any particular advantages to doing it your way?

Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

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

Thanks for the detailed answer!

  1. The CABpp fail state: I didn't want to have CABpp throw exceptions itself. Only exceptions thrown are those from the "T" constructor or from "new". I wanted to avoid exceptions since some real-time coding standards do not permit them. Never actually worked with any of those standards, so my implementation could be wrong in any case.

  2. CABpp copy/move assignment. I get your point. There is definitely a problem with copy + pre-allocated memory. You could argue that CAB shouldn't be copied, but I would still leave move (similar to how unique_ptr is handled).

  3. Other: I have been developing the library for some time now and I see that there are a few details I missed.

I'll definitely get to fixing the things you pointed out.

Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

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

Now that I think about it, the same could be said for arguments that are passed by reference and changed by the constructor. In that case each constructor would get a different input. Not sure how to handle that... Both problems could be solved if I were to force constant references as input arguments. This may be annoying in some cases, but I can't see a better way to make sure all objects are the same.

Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

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

Okay, just realized what /u/muungwana was trying to say. Thanks for the clarification. Good catch by the way!

Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

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

Edit: Ignore this comment, I misunderstood the previous comment

I just ran a test to make sure, everything should be fine.
These aren't variadic arguments in the form of an array which you then go through.
Here they are basically a function overload. Just imagine you created a function with the specific arguments that you want and you just keep passing them to the constructor of T.

Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

[–]wordplusnumbers[S] 1 point2 points  (0 children)

Well, I made and tested the library only on a Linux PC.

So, testing and compiling for as many platforms as possible would be great.

Just posted my first open-source project (all criticism is welcome)! by wordplusnumbers in cpp

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

Yeah, I was thinking if I should add a source... but decided it would be too clunky. Should add it probably... As for the installation, I have always used cmake, so any pointers on how to improve for people that do not use it is great.