[Cpp-Programming] Re: what's the difference of int and long on 32bit system?
This is a misconception between the guarantee from the C++ standard
and the size of an address in a specific architecture.
note that the standard only guarantees the following: 1 ==
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <=
sizeof(long long)
(for examples of 64-bit architectures using 32-bit width for int refer
to http://en.cppreference.com/w/cpp/language/types#Properties)
FYI size_t is the integral data type which is guaranteed to be able to
hold any address.
Best,
BeyelerStudios
On 19 Apr., 16:24, Fabricio Rossi <fabricio.ro...@gmail.com> wrote:
> is for the arquitecture , in 32bits a int are 4 bytes, in 64bits
> arquitecture a int is 8 bytes.
> try with cout << sizeof(int) to view the size...
> good luck...
> El abr 19, 2012 3:19 a.m., "srivatsa KS" <srivatsa...@gmail.com> escribió:
>
>
>
>
>
>
>
> > that's one of the reason which makes cpp platform dependent
>
> > Sent via android
> > On Apr 19, 2012 11:26 AM, "Gitanjali Pradhan" <gitanjali.c...@gmail.com>
> > wrote:
>
> >> i searched the web and also went through some books and came to a
> >> conclusion that they are basically the same but the difference between
> >> int and long depends on the type of processor.
>
> >> --
> >> ...
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "C++ Programming" group.
> >> To post to this group, send email to cpp-programming@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> cpp-programming+unsubscribe@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/cpp-programming?hl=en.
>
> >> --
> > You received this message because you are subscribed to the Google Groups
> > "C++ Programming" group.
> > To post to this group, send email to cpp-programming@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cpp-programming+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/cpp-programming?hl=en.
--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.
0 Comments:
Post a Comment
<< Home