#define of TRUE and FALSE

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked
        Since I cannot post complex texts due to the poor forum-software here a link to a better readable post   
http://www.psocdeveloper.com/forums/viewtopic.php?f=3&t=11329   
   
Bob   
0 Likes
5 Replies
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

 Assume you need a function to determine if a furnace is hot. You implement the following:

   

#define TRUE 1

   

#define FALSE 0

   

unsigned char isHot()

   

{

   

    // determine if furnace is hot and return the value

   

   return (TRUE);

   

   // else

   

  return (FALSE);

   

}

   

In other functions you have tests like these

   

if (isHot() == TRUE)

   

 

   

As your project progresses you have lesser program memory and you want to overload your isHot() function to return furnace temperature. Now the function return values are 0 for not hot, and 1 to max for furnace temperature. This is sure to break down your tests. You will have to change them as follows

   

if (isHot() != FALSE)

   

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This seems to be applicable -

   

 

   

    

   

          http://www.geeksforgeeks.org/does-c-support-function-overloading/

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

<a  href="http://www.codeverb.com/cpp-interview-questions"> Programming platform</a>

0 Likes
Anonymous
Not applicable

Codeverb is simply an all in one interactive learning portal, we regularly add new topics and keep improving the existing ones

   

http://www.codeverb.com/

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome here in the Cypress Developer Community.

   

I cannot see the relation between Cypress and codeverb. When you have any questions regarding PSoCs or other Cypress products do not hesitate to ask them. But it is not a good practice to hijack a three years old thread.

   

 

   

Bob

0 Likes