Thread: Platform Detection Library?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cyberfish View Post
    32/64-bit detection is easy.

    Code:
    printf("%d-bit", sizeof(int *)*8);
    Sure, but you could just as well just #define it, since you know what you're compiling for. The more interesting question is how to determine, if you are a 32-bit app, whether you are running on a 64-bit processor.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  2. #2
    Registered User
    Join Date
    Aug 2008
    Posts
    129
    Salem, the quote was talking not about standard C/C++ but about standard UNIX. Do "POSIX or X/Open" require any macros for identification of compatible systems? If not, what am I missing? Is SF just wrong?

    Quote Originally Posted by brewbuck View Post
    Sure, but you could just as well just #define it, since you know what you're compiling for.
    How would you #define it if the same source is preprocessed and compiled for both 32-bit and 64-bit?

    Quote Originally Posted by brewbuck View Post
    The more interesting question is how to determine, if you are a 32-bit app, whether you are running on a 64-bit processor.
    But what is a 32-bit app? What makes a program compatible with each bit-width?

    And why wouldn't cyberfish's detection work for that?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 06:04 AM
  2. Looking for light cross platform Threading library
    By umen242 in forum C++ Programming
    Replies: 7
    Last Post: 03-28-2008, 04:23 PM
  3. Cross platform XML library
    By Josh Kasten in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2007, 04:04 PM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM