sizeof operator doesn't work properly in call with static data members
From: balasubramaniam (balucit_at_yahoo.co.in)
Date: 11/30/03
- Next message: Thore Karlsen: "Re: sizeof operator doesn't work properly in call with static data members"
- Previous message: Dave O'Hearn: "Re: forward declaration related problem"
- Next in thread: Thore Karlsen: "Re: sizeof operator doesn't work properly in call with static data members"
- Reply: Thore Karlsen: "Re: sizeof operator doesn't work properly in call with static data members"
- Reply: Andrey Tarasevich: "Re: sizeof operator doesn't work properly in call with static data members"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Nov 2003 21:15:49 -0800
I comile the code in unix where sizof(int)=4
#include<iostream>
using namespace std;
class A
{
int i;
static int j;
};
int A::j = 10;
int main()
{
cout<<sizeof(A)<<endl;
}
both i,j are members of class A.so sizeof(A) should be printed as 8.
But i get 4.
could anyone explain this behavior.
- Next message: Thore Karlsen: "Re: sizeof operator doesn't work properly in call with static data members"
- Previous message: Dave O'Hearn: "Re: forward declaration related problem"
- Next in thread: Thore Karlsen: "Re: sizeof operator doesn't work properly in call with static data members"
- Reply: Thore Karlsen: "Re: sizeof operator doesn't work properly in call with static data members"
- Reply: Andrey Tarasevich: "Re: sizeof operator doesn't work properly in call with static data members"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|