Thread: macro not working.

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    2

    macro not working.

    Hey Guys.

    First time posting here. I defined a macro as follows:

    #define VPressureSUPPLY 5.0
    #define mpx4115VOLTStoPRESSURE(VOLTS) (VOLTS + 0.095) / (VPressureSUPPLY * 0.009)

    Then in my code, I called the above macro as follows:

    pressurekPA = mpx4115VOLTStoPRESSURE(vPressure);

    Issue is for vPressure = 0, pressurekPA is 2.11 instead of 0.019. What is the problem?

    Thanks!

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    There is no problem. 2.11 is the correct result.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    2
    You are right! I just checked it and it is indeed 2.11. I just calculated it wrong.
    Thanks for the quick response!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Help explaining test questions
    By Sentral in forum General Discussions
    Replies: 26
    Last Post: 11-09-2009, 11:10 PM
  3. g++ error: Macro names must be identifiers.
    By eccles in forum C++ Programming
    Replies: 2
    Last Post: 01-15-2005, 03:28 AM
  4. need a macro that does nothing
    By Nyda in forum C Programming
    Replies: 5
    Last Post: 11-18-2004, 10:16 AM
  5. Macro Program
    By daspope in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2004, 04:02 AM