ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all. Being introduced to libraries in C which are very helpful, as C has been around for ages and pretty much everything at a low level that you can think to create has already been done and redone a million times.
So, my question is this: How do you search/know what is available to you in libraries? For example, I created a 'power()' function to raise a number to a power, which was already available to me in <math.h>.
What is the standard/common/preferred way of checking, searching or finding these functions in local libraries/packages before going out and creating your own?
Edit: While answering,. please understand that powers() is an example of one single function out of thousands. Think 'generally.'
Last edited by szboardstretcher; 11-25-2014 at 01:44 PM.
So, my question is this: How do you search/know what is available to you in libraries? For example, I created a 'power()' function to raise a number to a power, which was already available to me in <math.h>.
The standard C library is small enough that you can remember it all.
Assuming I forgot that power() is available in the standard library: if I only need integer powers the obvious multiplying loop is simple enough that I would just use that directly (i.e. it's faster to use that than start looking up a library function for it). If I need real number powers then I'd have to look up the method to compute that; I would search for libraries at the same time to see which approach is going to be easier.
This seems to be the most straight-forward, assuming you know what the function is called.
Quote:
Originally Posted by ntubski
The standard C library is small enough that you can remember it all.
That's true, upon inspection.
But there are millions of libraries. How do the professional C programmers keep from re-inventing the wheel constantly? Do they just download ALL the *-devel packages and grep through the header files for related functions, or do they go on a forum and ask about existing functions, or is there a central repository for them, or is there a wiki, or is there a secret IRC channel, or is there a handy programmers 'function finder' program, or a web based 'header crawler' that indexes them,..
No one is memorizing millions of headers and functions. But, there has to be some kind of known method to finding pre-made functions to implement them.
In any big project, there are hundreds of library dependencies. How do C people find and use those library dependencies?
Last edited by szboardstretcher; 11-25-2014 at 01:51 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.