Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > difference between int and long

Reply
Thread Tools

difference between int and long

 
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      01-17-2007
Grizlyk wrote:

>
> Alf P. Steinbach wrote:
>
>> Yep, that's the old "eat dung" argument, that twenty zillion flies can't

>
> No, it is not "eat dung". Ii is standard international (SI) measure of
> information or storage capacity, used by most people in practical
> cases, similarly to meter or second.
>
>> > But C++ "char" is not a "byte". C++ "char" is minimal system depended
>> > granularity (part) of memory,

>>
>> Sorry, that's incorrect. See 1.7/1 (byte defined as fundamental
>> storage unit), 3.9/2 (effective equivalence of bytes and chars wrt.
>> copying PODs) and 5.3.3/1 (sizeof yields the number of bytes, sizeof
>> char is 1).

>
> You are right formally, but fortunatelly, the part of standard can be
> silently ignored at practical cases, as well as we can silently ignore
> existence of keyword "goto".


Actually, we cannot ignore either of those in this group: neither for
practical purposes nor (and more importantly) for discussing C++.

> I am shure, if you will describe storage
> capacity elsewere out of C++ context, much better for all (and for you
> too) to use constant "byte, Kbyte, Mbyte and so on" size instead of
> "13-bit C++ bytes", if you want, that your opponent can understand what
> did you say.


Sure. It is somewhat unfortunate that the C++ standard is intruding quite a
bit into the ordinary English language by specializing the meanings of
common terms such
as "exception", "object", "undefined" / "unspecified" / "implementation
defined" (behavior) or, in this case, "byte". However, communication in
this group is greatly simplified if everybody just sticks to two simple
conventions:

a) If the standard defines the meaning of a term, do not use that term with
a different meaning without explicitly indicating so.

b) If the standard provides a term for a concept and you mean that concept,
use the terminology used in the standard.

As these two rules of thumb have proven quite useful, regulars tend to be
quite opinionate about breaking those rules willfully.

Note that I am not arguing that you should not use "byte" in its ordinary
meaning outside this group. But within this group, it has proven useful to
avoid confusion arising from competing meanings. The resolution of such
competition is: the meaning used in the standard wins.


> And fortunatelly, "byte" is not C++ keyword, so we can easy use "char"
> - C++ specific memory size as base for all types.


That "byte" is not a keyword does not make it any less C++ specific
terminology as, say, "object", which is also not a keyword.


Best

Kai-Uwe Bux
 
Reply With Quote
 
 
 
 
Grizlyk
Guest
Posts: n/a
 
      01-19-2007

Kai-Uwe Bux wrote:

> Grizlyk wrote:
>
> > I am shure, if you will describe storage
> > capacity elsewere out of C++ context, much better for all (and for you
> > too) to use constant "byte, Kbyte, Mbyte and so on" size instead of
> > "13-bit C++ bytes", if you want, that your opponent can understand what
> > did you say.

>
> Sure. It is somewhat unfortunate that the C++ standard is intruding quite a
> bit into the ordinary English language by specializing the meanings of
> common terms such
> as "exception", "object", "undefined" / "unspecified" / "implementation
> defined" (behavior) or, in this case, "byte". However, communication in
> this group is greatly simplified if everybody just sticks to two simple
> conventions:


Are you really do not see defferences between SI definitions and other
"words" in the world?

Well, maybe "byte" is not defined in SI, but the fixed size of byte (8
bit) is conventional for most peolpe in the world. And no one "cometee"
of any language can not force people to have more than one "byte" with
different meaning, as no one "cometee" can not introduce two types of
"dollar": "ordinary dollar"- 100-cents, and "C++ dollar" - with
variable number of cents, for example 315 cents.

Especially, when C++ has own replacement for "C++ specific byte" - it
is "char". There is no sence to have in C++ "byte" definition (which
constradiscts to ordinary "byte" definition), because "char" exist.

To discuss "to define 'C++ specific byte' or do not" is time wasted.

 
Reply With Quote
 
 
 
 
Grizlyk
Guest
Posts: n/a
 
      01-19-2007
Grizlyk wrote:
>
> e) 8bit<=char<=short<=int<=long
>

Accordance to "The design and evolution of C++"
e) 8bit<=char<=short<=16bit<=int<=long

 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      01-19-2007
Grizlyk wrote:

>
> Kai-Uwe Bux wrote:
>
>> Grizlyk wrote:
>>
>> > I am shure, if you will describe storage
>> > capacity elsewere out of C++ context, much better for all (and for you
>> > too) to use constant "byte, Kbyte, Mbyte and so on" size instead of
>> > "13-bit C++ bytes", if you want, that your opponent can understand what
>> > did you say.

>>
>> Sure. It is somewhat unfortunate that the C++ standard is intruding quite
>> a bit into the ordinary English language by specializing the meanings of
>> common terms such
>> as "exception", "object", "undefined" / "unspecified" / "implementation
>> defined" (behavior) or, in this case, "byte". However, communication in
>> this group is greatly simplified if everybody just sticks to two simple
>> conventions:

>
> Are you really do not see defferences between SI definitions and other
> "words" in the world?
>
> Well, maybe "byte" is not defined in SI, but the fixed size of byte (8
> bit) is conventional for most peolpe in the world.


True and already conceded.

> And no one "cometee"
> of any language can not force people to have more than one "byte" with
> different meaning, as no one "cometee" can not introduce two types of
> "dollar": "ordinary dollar"- 100-cents, and "C++ dollar" - with
> variable number of cents, for example 315 cents.


Actually, it can. In the very same way that mathematicians have overloaded
the terms "group", "ring", "field", "loop", etc. Once introduced by the
standard, the specialized meanings are default meanings In This News Group.

> Especially, when C++ has own replacement for "C++ specific byte" - it
> is "char". There is no sence to have in C++ "byte" definition (which
> constradiscts to ordinary "byte" definition), because "char" exist.
>
> To discuss "to define 'C++ specific byte' or do not" is time wasted.


Whatever.


Best

Kai-Uwe Bux
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Promoting unsigned long int to long int pereges C Programming 112 07-28-2008 05:00 AM
Having compilation error: no match for call to (const __gnu_cxx::hash<long long int>) (const long long int&) veryhotsausage C++ 1 07-04-2008 05:41 PM
Difference between int i, j; and int i; int j; arun C Programming 8 07-31-2006 05:11 AM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
dirty stuff: f(int,int) cast to f(struct{int,int}) Schnoffos C Programming 2 06-27-2003 03:13 AM



Advertisments