473,480 Members | 5,041 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sizeof(int) and sizeof(long int)

2 New Member
Hi to everyone,

I exexuted sizeof(int) and sizeof(long int) and I got the result ¨4¨ from both. I´m using the gcc 3.3.5. Shouldn´t sizeof(long) produce ¨8¨? Am I doing something wrong?

Thanks
Spyros
Sep 18 '05 #1
1 22178
vpawizard
66 New Member
No nothing is wrong. The size of data-types is generally hardware dependant (exception being char which is always 1 register wide). In gcc/Unix, int and long int both require 4 bytes. You can also try sizeof(long long int) and see the results and sizeof(short int).
Nov 16 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

70
8799
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
28
3594
by: Richard Cavell | last post by:
Hi, Is there some kind of canonical list, or would someone like to give a brief rundown, as to: sizeof(int) sizeof(long int) sizeof(long long) etc
4
8633
by: Lingyun Yang | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** Dear all, I have a file it's binary data viewed in UltraEdit is EF BB BF 0D 0A 3C ....... I want to read them into a int or long...
2
3645
by: blufox | last post by:
I read somewhere that standard Ansi C on 32 bit architecures assumes a lot of things which lead to poor code. For example sizeof( int ) = sizeof( void * ) sizeof( long ) = sizeof( int ) Why...
56
3907
by: write2gops | last post by:
Hi, Is there a way to change the sizeof int type? Is it posible to make it return 3 or 5 by changing some header file in the compiler? Thanks in advance.
5
2878
by: Francois Grieu | last post by:
Does this reliably cause a compile-time error when int is not 4 bytes ? enum { int_size_checked = 1/(sizeof(int)==4) }; Any better way to check the value of an expression involving sizeof...
40
3578
by: Spiros Bousbouras | last post by:
Do you have an example of an implementation where sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long...
12
3612
by: aarklon | last post by:
Is y >(8 * (sizeof(int) -1)) portable expression to find The MSB of an unsigned integer y ?? will this work in all the cases, all three of the representations C allows: 1) two's complement...
5
3583
by: aarklon | last post by:
Hi all, why printf("....%d",sizeof((int)(double)(char) i)) always gives the size of int ??? is it because sizeof doesn't evaluate its operand....???
0
7040
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6905
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7041
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4478
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2994
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.