#C++ library design

15 messages · Page 1 of 1 (latest)

slow hazel
#

short version:
What are the general guidelines to making libraries?

long version:
I'm currently experimenting with making a C++ lib for x86 hardware information fetching. This is my first sort of hands-on experience with trying to make a lib and I just want to hear the advice of people who know far better than me. I have a few questions so i'll list them here:

  1. What are the main considerations/guidelines in making libs?
  2. Are there fundamental ideas like RAII but for lib design? If not, what are the core philosophies if there are any?
  3. What tools/services can I use to test my code in a cross-platform environment?
  4. Same as above, but are there cross-vendor testing platforms that allows me to run code in different x86 CPU brands?
  5. What's the priority between performance and code readability specifically for libs?

I'm not taking my project seriously to be important/useful to other people but I would still like to hear your thoughts and maybe even personal experience in library design. It would be greatly appreciated.

mossy muralBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

mossy marsh
#

the hell is x86 hardware information fetching

#

what you working on

#

oh you working with CPUID

#

Never worked with that but I'd just
|| Use C ||

slow hazel
#

like i get i could use C but that's not the point of my question

terse prawn
#
  1. Make the library easy to use correctly, and when things do go wrong, report errors well.

  2. Not really, you choose your philosophy based on your library's goal.

3 & 4. Unfortunately IMO the best way is to just manually test with different VMs. Or I think CI is closer to what's on your mind.

  1. Your choice again. But TBH you can get both without compromising much.
#

mfw can never remember which bracket comes first for markdown links nooo

slow hazel
#

appreciate it

#

!solved