#ifndef _MATH_H

This is a discussion on #ifndef _MATH_H within the C Programming forums, part of the General Programming Boards category; probably this is a stupid question ... at least, it sounds stupid. I've taken recently to reading *.h in my ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    82

    #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).

    Cheers.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,249
    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.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    82
    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, 05: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, 12:41 PM
  5. #ifndef
    By paperbox005 in forum C Programming
    Replies: 4
    Last Post: 09-24-2004, 07:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21