

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to determine whether C++ code has been compiled in 32 or 64 bit?
In C++, there is no direct way to check the environment architecture. There are two Macros for Windows systems, that can be used to check the architecture. These macros are _WIN64, and _WIN32. When the system is 64-bit, then the _WIN64 will be 1, otherwise the _WIN32 will be 1. So using macro checking, we can identify the architecture
Example
#include <iostream> using namespace std; int main() { #ifdef _WIN64 cout << "This is 64 bit system" << endl; #elif _WIN32 cout << "This is 32 bit system" << endl; #endif }
Output
This is 64 bit system
- Related Questions & Answers
- How to find out linux operating system system is 32 bit or 64 bit
- Difference between 32-bit and 64-bit operating systems
- Differentiate between 32-Bit vs. 64-Bit Operating System.
- How to compile 32-bit program on 64- bit gcc in C and C++
- Compile 32-bit program on 64-bit gcc in C and C++
- Determine whether input has masked values
- 32-bit microprocessors
- Python Pandas - Check whether the DateOffset value has been normalized or not
- Python Pandas - Check whether the BusinessDay Offset has been normalized or not
- Python Pandas - Check whether the BusinessHour Offset has been normalized or not
- Python Pandas - Check whether the CustomBusinessDay Offset has been normalized or not
- Python Pandas - Check whether the CustomBusinessHour Offset has been normalized or not
- How to determine if an activity has been called by a Notification in Android?
- ConvertDecimal to equivalent 32-bit unsigned integer in C#
- Is PHP compiled or interpreted?
Advertisements