Press "Enter" to skip to content

C++判断本机的字节序的方法

 

1bool isBigEnding(){
    
int i = 1;
    
return ((char)i) == 1;
}

2bool isBigEnding(){
    union 
{
       
int i;
       
char c;
   }
x={1};
   
return x.c == 1;
}


3. bool isBigEnding{
   union 
{
      
int i ;
      
struct {
          unsigned 
short int b : 8;
      }
bit;
   }
x={1};
   
return x.bit.b == 1;
}

3 Comments

  1. HelmetHeroes
    HelmetHeroes 2018-08-21

    Helmet Heroes http://helmetheroes.games is a an enormously multiplayer duty having fun video game in which you can team up with your on the internet close friends and discover regions and also battle against enemies.

    It showcases virtually 40 adversaries, numerous different weapons, helmets, armor, as well as devices. You can select between being a warrior, archer, wizard, or cowboy. Or if you ‘d like, you can combine courses as well as produce you own mix. You could also twin possess weapons and utilize shields. There are a multitude of special abilities to choose from in addition to the ability to let loose significant planet shaking energy degrees to excite other players and also assist you bang via waves of opponents. In your downtime from dealing with, you could fish for over 40 different fish, or you can cut down trees to obtain wood to craft new tools. You can also purchase family pets which will aid you battle enemies and you can even ride them!

  2. Deleting the history of is necessary to protect your data from other user of the system and also for increasing the browsing speed of bing history deletion is important.

  3. happywheelsnow.com
    happywheelsnow.com 2017-12-30

    I didn’t find this kind of information till now. Thank you so much for sharing this information.

Leave a Reply

Your email address will not be published. Required fields are marked *