32bit-64bit interview questions
Top 32bit-64bit frequently asked interview questions
I've been using Cygwin (for a long time). Specifically, I use it (including gcc/g++) on Win7 for development work. I've just recently noticed there now exists a 64-bit version.
I don't have a specific need which requires that I make the transition to 64-bit, but I was wondering whether to do it anyway. Is it advisable? What are the pros and cons? Are there known over-arcing issues when making the transition?
Source: (StackOverflow)
How can I find out if a specific Eclipse instance on my (Windows 7) PC is the 32-bit or 64-bit version?
I've checked the About screen and the maze of dialogs one can call from there, but I didn't find any clues.
Also, right-clicking eclipse.exe in Windows explorer and opening the properties dialog box didn't give any hints.
Source: (StackOverflow)
I'm looking for a way to reliably determine whether C++ code is being compiled in 32 vs 64 bit. We've come up with what we think is a reasonable solution using macros, but was curious to know if people could think of cases where this might fail or if there is a better way to do this. Please note we are trying to do this in a cross-platform, multiple compiler environment.
#if ((ULONG_MAX) == (UINT_MAX))
# define IS32BIT
#else
# define IS64BIT
#endif
#ifdef IS64BIT
DoMy64BitOperation()
#else
DoMy32BitOperation()
#endif
Thanks.
Source: (StackOverflow)
I developed a Windows service using C#.NET to generate PDF report. To generate PDF file I am using a third party dll. The application is running in my Windows XP platform. When I deployed the service in Windows Server 2008 64 bit version, I got this error:
Retrieving the COM class factory for
component with CLSID
{46521B1F-0A5B-4871-A4C2-FD5C9276F4C6}
failed due to the following error:
80040154.
I registered the DLL using the regsvr32 command. I able to see this CLSID in the registry. But the problem persists.
What could be the problem?
Source: (StackOverflow)
Since Ubuntu 13.10 no longer has ia32-libs I cannot get my android development environment running on a clean install of 13.10.
The error is ~/android-studio/sdk/build-tools/android-4.2.2/aapt": error=2, No such file or directory
This file does exist and is executable but it is a 32bit executable.
In previous installs I just installed ia32-libs to fix this but this solution no longer works for Ubuntu 13.10.
I have tried solutions proposed by askubuntu questions eg. this one http://askubuntu.com/questions/107230/what-happened-to-the-ia32-libs-package
but it isn't working for me.
From that askubuntu.com answer I see I should install separate packages with
sudo apt-get install package:i386
but I don't know which packages to install to make the android tools work again.
Has anyone else solved this problem and or does anyone have a list of packages which need to be installed for the android tools?
Source: (StackOverflow)
We distribute in Linux a static lib in both 64-bit and 32-bit versions. When troubleshooting a customer, I would like my diagnostic shell script to quickly eliminate the issue by checking the .a archive file to detetmine whether it is 32 or 64 bit. The methods that occur to me are less than elegant:
extract a .o member and ask the "file" command (e.g., ELF 32-bit etc)
start including a dummy member coded to indicate, e.g. 32bit.o/64bit.o and use "ar -t" to check
I have tried "strings xyz.a | grep 32" but this doesn't work well over versions. Not a heartbreaker problem, but if you know of an elegant solution, I would like to know.
Thanks!
Source: (StackOverflow)
I have a win7 64bit installation. Must I use Python 64bit? What are the differences between the 32bit and 64bit Python versions anyway? Do different Python packages (such as south, django, mysqldb etc) support only 32bit\64bit?
Source: (StackOverflow)
Is it possible to install both 32bit and 64bit Java on Windows 7?
I have some applications that I can run under 64bit, but there are some that only run under 32bit.
Source: (StackOverflow)
How can my C# application check whether a particular application/process (note: not the current process) is running in 32-bit or 64-bit mode?
For example, I might want to query a particular process by name, i.e, 'abc.exe', or based on the process ID number.
Source: (StackOverflow)
I'm running Windows 8.1 x64 with Java 7 update 45 x64 (no 32 bit Java installed) on a Surface Pro 2 tablet.
The code below takes 1688ms when the type of i is a long and 109ms when i is an int. Why is long (a 64 bit type) an order of magnitude slower than int on a 64 bit platform with a 64 bit JVM?
My only speculation is that the CPU takes longer to add a 64 bit integer than a 32 bit one, but that seems unlikely. I suspect Haswell doesn't use ripple-carry adders.
I'm running this in Eclipse Kepler SR1, btw.
public class Main {
private static long i = Integer.MAX_VALUE;
public static void main(String[] args) {
System.out.println("Starting the loop");
long startTime = System.currentTimeMillis();
while(!decrementAndCheck()){
}
long endTime = System.currentTimeMillis();
System.out.println("Finished the loop in " + (endTime - startTime) + "ms");
}
private static boolean decrementAndCheck() {
return --i < 0;
}
}
Edit: Here are the results from equivalent C++ code compiled by VS 2013 (below), same system. long: 72265ms int: 74656ms Those results were in debug 32 bit mode.
In 64 bit release mode: long: 875ms long long: 906ms int: 1047ms
This suggests that the result I observed is JVM optimization weirdness rather than CPU limitations.
#include "stdafx.h"
#include "iostream"
#include "windows.h"
#include "limits.h"
long long i = INT_MAX;
using namespace std;
boolean decrementAndCheck() {
return --i < 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
cout << "Starting the loop" << endl;
unsigned long startTime = GetTickCount64();
while (!decrementAndCheck()){
}
unsigned long endTime = GetTickCount64();
cout << "Finished the loop in " << (endTime - startTime) << "ms" << endl;
}
Edit: Just tried this again in Java 8 RTM, no significant change.
Source: (StackOverflow)
This question already has an answer here:
Possible Duplicate:
How to also prepare for 64-bits when migrating to Delphi 2010 and Unicode
Since I believe that 64bit Delphi compiler will appear soon,
I am curious if anybody knows what kind of programs
that are now 32bit will compile and work without any changes
when using 64bit compiler.
And if there is a general rule what kind of changes should we
systematically make in our old programs to be compiled
as 64bit?
It is good to be prepared when the 64bit compiler will suddenly be here...
Any suggestion will be much appreciated.
Source: (StackOverflow)
I am running the 32bit version of Ubuntu 10.10 and trying to cross compile to a 64 bit target. Based on my research, I have installed the g++-multilib package.
The program is a very simple hello world:
#include <iostream>
int main( int argc, char** argv )
{
std::cout << "hello world" << std::endl;
return 0;
}
Compile:
g++ -m64 main.cpp
Error:
In file included from main.cpp:1:
/usr/include/c++/4.4/iostream:39: fatal error: bits/c++config.h: No such file or directory
compilation terminated.
I have found a c++config.h
file but they reside under the i486-linux-gnu
and i686-linux-gnu
directories in /usr/include/c++/4.4/
There is not c++config.h
in /usr/include/c++/bits
.
Any ideas on what I am missing? Compiling without the -m64
flag works fine (a.out is created and runs correctly).
Edit Thanks to the hint from @nightcracker, I did a little more investigation into the include structure on the 32 and 64 bit systems. I have added an answer below that "fixes" the problem temporarily but I think it will break on the next update. Basically, I am missing a directory called /usr/include/c++/4.4/i686-linux-gnu/64
that should contain a subdirectory called bits
that has the missing include file. Any idea what package should be taking care of this?
Source: (StackOverflow)
A NSInteger
is 32 bits on 32-bit platforms, and 64 bits on 64-bit platforms. Is there a NSLog
specifier that always matches the size of NSInteger
?
Setup
- Xcode 3.2.5
- llvm 1.6 compiler (this is important; gcc doesn't do this)
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF
turned on
That's causing me some grief here:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
@autoreleasepool {
NSInteger i = 0;
NSLog(@"%d", i);
}
return 0;
}
For 32 bit code, I need the %d
specifier. But if I use the %d
specifier, I get a warning when compiling for 64 bit suggesting I use %ld
instead.
If I use %ld
to match the 64 bit size, when compiling for 32 bit code I get a warning suggesting I use %d
instead.
How do I fix both warnings at once? Is there a specifier I can use that works on either?
This also impacts [NSString stringWithFormat:]
and [[NSString alloc] initWithFormat:]
.
Source: (StackOverflow)
I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error "Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine ".
So as a solution to this issue, i have changed the build property of the project to X86, so that it will build in 32 bit mode, and rebuild the project in the 32bit machine. But, the same project uses other DB drivers (DB2, SQL etc.) to connect to other databases. So when i deployed my app again in the 64 bit OS, it throws the exception " Attempted to load a 64-bit assembly on a 32-bit platform. "
I am using the Microsoft.Jet.OLEDB.4.0 driver to read and write to the Excel (.xls)
Source: (StackOverflow)
This question already has an answer here:
I'd like to write a test script or program that asserts that all dlls in a given directory are of a particular build type.
I would use this as a sanity check at the end of a build process on an sdk to make sure that the 64bit version hasn't somehow got some 32bit dlls in it and vice versa.
Is there an easy way to look at a dll file and determine its type?
The solution should work on both xp32 and xp64.
Source: (StackOverflow)