Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


#Actualxiajia

Posted 24 December 2012 - 09:24 PM

bool a;  //no initialized
if(a == true)
{
    //do 1
}
if(a == false)
{
   //do 2
}

 


Result is not 'do 1' nor 'do 2'.'a' is not initialized. 'a' is not 'true' nor 'false'.This is contrary to the definition of 'bool' logic.'bool' variable is either 'true' or 'false'.Can not have the other values.According to the interpretation of a friend before.'true' should be a logical value, rather than an actual value.That is 'true' should be '! false', rather than the other what the exact value.But that there is no way to express in a programming language.We can refer to a lot about bool definition.

in VS "windef.h"
 

 

 

typedef int BOOL;
#define FALSE 0
#define TRUE 1

 

in SDL
 

 

 

typedef enum 
{ 
    SDL_FALSE = 0, 
    SDL_TRUE  = 1
}SDL_bool;

 

People trying to use an exact value represents the 'true', But this logic is wrong.So I think that should be realized through the state variables to solve this problem.the method I mentioned before.
For example:

 

 

bool a = 2;
if(a)
{ 
//do true
}
if(!a)
{ 
//do false
}

 

the result is 'do true'.It is correct from logical?


#5xiajia

Posted 24 December 2012 - 04:31 AM

bool a;

if(a == true)

{

    //do 1

}

if(a == false)

{

   //do 2

}


Result is not 'do 1' nor 'do 2'.'a' is not initialized. 'a' is not 'true' nor 'false'.This is contrary to the definition of 'bool' logic.'bool' variable is either 'true' or 'false'.Can not have the other values.According to the interpretation of a friend before.'true' should be a logical value, rather than an actual value.That is 'true' should be '! false', rather than the other what the exact value.But that there is no way to express in a programming language.We can refer to a lot about bool definition.

in VS "windef.h"
typedef int BOOL;
#define FALSE               0
#define TRUE                1

in SDL
typedef enum {
 SDL_FALSE = 0,
 SDL_TRUE  = 1
} SDL_bool;

People trying to use an exact value represents the 'true', But this logic is wrong.So I think that should be realized through the state variables to solve this problem.the method I mentioned before.
For example:

bool a = 2;
if(a)
{
 //do true
}
if(!a)
{
 //do false
}
the result is 'do true'.It is correct from logical?


#4xiajia

Posted 24 December 2012 - 04:29 AM

bool a;

if(a == true)

{

    //do 1

}

if(a == false)

{

   //do 2

}


Result is not 'do 1' nor 'do 2'.'a' is not initialized. 'a' is not 'true' nor 'false'.This is contrary to the definition of 'bool' logic.'bool' variable is either 'true' or 'false'.Can not have the other values.According to the interpretation of a friend before.'true' should be a logical value, rather than an actual value.That is 'true' should be '! False', rather than the other what the exact value.But that there is no way to express in a programming language.We can refer to a lot about bool definition.

in VS "windef.h"
typedef int BOOL;
#define FALSE               0
#define TRUE                1

in SDL
typedef enum {
 SDL_FALSE = 0,
 SDL_TRUE  = 1
} SDL_bool;

People trying to use an exact value represents the 'true', But this logic is wrong.So I think that should be realized through the state variables to solve this problem.the method I mentioned before.
For example:

bool a = 2;
if(a)
{
 //do true
}
if(!a)
{
 //do false
}
the result is 'do true'.It is correct from logical?


#3xiajia

Posted 24 December 2012 - 04:27 AM

bool a;

if(a == true)

{

    //do 1

}

if(a == false)

{

   //do 2

}


Result is not 'do 1' nor 'do 2'.'a' is not initialized. 'a' is not 'true' nor 'false'.This is contrary to the definition of 'bool' logic.'bool' variable is either 'true' or 'false'.Can not have the other values.According to the interpretation of a friend before.'true' should be a logical value, rather than an actual value.That is 'true' should be '! False', rather than the other what the exact value.But that there is no way to express in a programming language.We can refer to a lot about bool definition.

in VS "windef.h"
typedef int BOOL;
#define FALSE               0
#define TRUE                1

in SDL
typedef enum {
 SDL_FALSE = 0,
 SDL_TRUE  = 1
} SDL_bool;

People trying to use an exact value represents the 'true', but this is the logic is wrong.So I think that should be realized through the state variables to solve this problem.the method I mentioned before.
For example:

bool a = 2;
if(a)
{
 //do true
}
if(!a)
{
 //do false
}
the result is 'do true'.It is correct from logical?


#2xiajia

Posted 24 December 2012 - 04:26 AM

bool a;

if(a == true)

{

    //do 1

}

if(a == false)

{

   //do 2

}


Result is not 'do 1' nor 'do 2'.'a' is not initialized. 'a' is not 'true' nor 'false'.This is contrary to the definition of 'bool' logic.'bool' variable is either 'true' or 'false'.Can not have the other values.According to the interpretation of a friend before.'true' should be a logical value, rather than an actual value.That should be the 'true' '! False', rather than the other what the exact value.But that there is no way to express in a programming language.We can refer to a lot about bool definition.

in VS "windef.h"
typedef int BOOL;
#define FALSE               0
#define TRUE                1

in SDL
typedef enum {
 SDL_FALSE = 0,
 SDL_TRUE  = 1
} SDL_bool;

People trying to use an exact value represents the 'true', but this is the logic is wrong.So I think that should be realized through the state variables to solve this problem.the method I mentioned before.
For example:

bool a = 2;
if(a)
{
 //do true
}
if(!a)
{
 //do false
}
the result is 'do true'.It is correct from logical?


#1xiajia

Posted 24 December 2012 - 04:24 AM

bool a;

if(a == true)

{

    //do 1

}

if(a == false)

{

   //do 2

}


Results not 'do 1' or 'do 2'.'a' is not initialized. 'a' is not 'true' nor 'false'.This is contrary to the definition of 'bool' logic.'Bool' variable is either 'true' or 'false'.Can not have the other values.According to the interpretation of a friend before.'true' should be a logical value, rather than an actual value.That should be the 'true' '! False', rather than the other what the exact value.But that there is no way to express in a programming language.We can refer to a lot about bool definition.

in VS "windef.h"
typedef int BOOL;
#define FALSE               0
#define TRUE                1

in SDL
typedef enum {
 SDL_FALSE = 0,
 SDL_TRUE  = 1
} SDL_bool;

People trying to use an exact value represents the 'true', but this is the logic is wrong.So I think that should be realized through the state variables to solve this problem.the method I mentioned before.
For example:

bool a = 2;
if(a)
{
 //do true
}
if(!a)
{
 //do false
}
the result is 'do true'.It is correct from logical?


PARTNERS