Thread: #ifndef _MATH_H

  1. #1
    Registered User
    Join Date
    Mar 2008

    #ifndef _MATH_H

    probably this is a stupid question ... at least, it sounds stupid.

    I've taken recently to reading *.h in my /usr/include dir to see what functions they might offer, but am always scared off with the amount of preprocessor type expressions that appear.

    these standard .h files (take math.h) seems to be littered with #ifndef and similar statements and variables with double underscore variables, some that looked a bit like environment variables, but others that don't.

    It's a pity I can't follow it all, cos then reading these files could be useful.

    If anybody can shed a little light or point me to some URLs, I'd appreciate it. (You could also say, "you're not meant to read them, period" or even better: "if you can't read them, then you're not meant to" :-D).


  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Portland, OR
    It's not a wasted exercise... You have to be careful though, because header files might contain things which look useful but are undocumented and subject to change. The library documentation should be what you work from, but for learning purposes, there's nothing wrong with poking through header files.

    System headers are usually strewn with tons of #ifdef because they are intended to work on various system configurations.
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);

  3. #3
    Registered User
    Join Date
    Mar 2008
    ah brewbuck, many thanks for your explanation. see pm ref. an earlier post.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. #ifndef explanation?
    By Zooker in forum C Programming
    Replies: 2
    Last Post: 02-12-2009, 06:59 AM
  2. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  3. Warning on an ifndef directive
    By DavidP in forum C++ Programming
    Replies: 2
    Last Post: 08-02-2007, 01:31 AM
  4. ORe identifier: #ifndef ID_1 || ID_2 || ....
    By mabuhay in forum C Programming
    Replies: 2
    Last Post: 02-15-2006, 01:41 PM
  5. #ifndef
    By paperbox005 in forum C Programming
    Replies: 4
    Last Post: 09-24-2004, 07:25 PM