I'm developing a c++ program that is dealing with addresses for different variables and functions.
When I compiled my program on a Linux based OS, all functions including the main get the address of 1 instead of an 8 digit hexa number like other variables, which did not happen in Windows.
I wrote this small piece of code to explain the issue
#include <iostream>
using namespace std;
void Function1();
void Function1(){
}
int main(){
int tmp;
void (*a) ()=&Function1;
cout<<a<<endl;
cout<<&Function1<<endl;
cout<<&main<<endl;
return 0;
}
for all 3 cout calls, the output is 1 instead of the virtual address.