Thread: Infants Doubt

  1. #1
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Unhappy Infants Doubt

    Hey all,
    Where are the bodies of all the functions declared in standard files like stdio.h, conio.h, stdlib.h etc stored. I could not trace out any OBJ or LIB files for them.

    Regards,
    Sriharsha.
    Help everyone you can

  2. #2
    Unregistered
    Guest
    I use the Borland 5.5 command line compiler. It has a folder named Include that has stdio.h as a 19K text file. Is that what you're asking?

  3. #3
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192
    Ok. OK. Let me make my doubt clear....


    If you look into standard header files like stdio.h, conio.h etc, you would only find #defines and the function prototypes. But you will not find the actual body of the function (or the actual code for that function) in that file. My doubt is where do you find the code for these functions, specifically, where does the compiler look for the function code when compiling.

    Regards,
    Sriharsha.
    Help everyone you can

  4. #4
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    This is soooooo funny haha. Anywyas you cant trace into them in a debugger without special libraries. When the standard headers were written for your compiler they are either a) linked to .lib files or b) put in to a .dll. Your compiler documentation and any good C/C++ book will tell you that these are "libraries" and some if not most are written in a combination of C/C++/ASM. When you compile and link the compiler knows which libaries to load from what you included (only the basic C or C++ runtime stuff no specifics like windows unless you have a compiler w/ specific workspace/projet settings)and stuff their bloat into your executable.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  5. #5
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192
    SO, you guys mean to say that the actual code for clrscr() can be found in conio.lib..

    But dear...I dont have conio.lib in the whole of my hard disk but still the function works perfectly well.


    Need more clarity.

    Best wishes,
    Sriharsha.
    Help everyone you can

  6. #6
    Unregistered
    Guest
    >>SO, you guys mean to say that the actual code for clrscr() can be found in conio.lib..

    >>But dear...I dont have conio.lib in the whole of my hard disk but still the function works perfectly well.

    I don't know which platform are you on but in unix look for something like libc.a for standard C library. There are a few other such libraries too. Don't look for conio.lib etc.
    Anoop.

  7. #7
    sridhar
    Guest

    Arrow

    even though you did not have conio.lib(this is error) , including conio.h should produce error

    further i guess that in turbo c++ it is not necessary for a function to be defined in its own library, for example some functions may be defined in other library and the header file will refer to that library. any how functions are written in c and assembly and they are stored in binary format in the library.

    further i guess, there must be an "automatic directing command" from the compiler to look for the funcion's definition in common library.

    -sridhar, au,chennai,india

  8. #8
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I have often wondered this, myself.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubt in pointer.
    By shwetha_siddu in forum C Programming
    Replies: 5
    Last Post: 03-21-2009, 01:28 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Doubt abt Storage!
    By kalamram in forum C Programming
    Replies: 1
    Last Post: 04-21-2006, 05:30 AM
  4. Greatest C++ Doubt
    By vasanth in forum C++ Programming
    Replies: 15
    Last Post: 02-28-2002, 04:41 AM