473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Is there is any strong reason not to use standard native C++ data types

Hi all,
Is there is any strong reason not to use standard C++ native datatypes.
The only reason I can imagine is protability issuse on different
machines.But did C++ not gurantee portaibilty of standard native datatypes ?
Aug 10 '05 #1
7 1539
hi abhishek,
no!!!

c++ dosn't gurantee the size of the native data types.
it only makes some very weak statements such as the size of int should
be greater than
or equal to short but never makes exact statement about the size.

thanks
rt.

Aug 10 '05 #2
ra************@gmail.com wrote:

please leave some context. The question is if C++ guarantees the
sizes of native data types

no!!!

c++ dosn't gurantee the size of the native data types.
it only makes some very weak statements such as the size of int should
be greater than
or equal to short but never makes exact statement about the size.


it does, however, specify a minimum size. A char is at least 8 bits, an
at leat 16 bits and a long at least 32 bits. There are similar promises
for floating point types. Unsigned are the same size as their
corresponding signed types

--
Nick keighley

Aug 10 '05 #3

Nick Keighley wrote:

[]
it does, however, specify a minimum size. A char is at least 8 bits, an
at leat 16 bits and a long at least 32 bits. There are similar promises
for floating point types. Unsigned are the same size as their
corresponding signed types


It does not.

It only states that:

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)

And that "Plain ints have the natural size suggested by the
architecture of the execution environment".

Refer to §3.9.1/2

Aug 10 '05 #4

Maxim Yegorushkin schreef:
Nick Keighley wrote:

[]
it does, however, specify a minimum size. A char is at least 8 bits, an
at leat 16 bits and a long at least 32 bits. There are similar promises
for floating point types. Unsigned are the same size as their
corresponding signed types


It does not.

It only states that:

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)


It also states that these must be implemnted in some kind of binary
system, and that the ranges are at least (-127,127), (-32767,32767)
and so on. (by reference from C90)
Those ranges imply additional minimum sizes, as Nick correctly noted.

HTH,
Michiel Salters

Aug 10 '05 #5

msalters wrote:
Maxim Yegorushkin schreef:
Nick Keighley wrote:

[]
it does, however, specify a minimum size. A char is at least 8 bits, an
at leat 16 bits and a long at least 32 bits. There are similar promises
for floating point types. Unsigned are the same size as their
corresponding signed types


It does not.

It only states that:

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)


It also states that these must be implemnted in some kind of binary
system, and that the ranges are at least (-127,127), (-32767,32767)
and so on. (by reference from C90)


C++ standard does not state that. C does indeed.

However, Derek M. Jones in his book "The New C Standard" quotes:

Resolutions Prepared at the Eleventh Plenary Meeting of
ISO/IEC JTC 1/SC22 Snekkersten, Denmark
August 24 27, 1998
Resolution 98-6: Relationship Between the Work of WG21 and that of WG14
Recognizing that the user communities of the C and C++ languages are
becoming increasingly divergent, ISO/IEC JTC 1/SC22 authorizes WG21 to
carry out future revisions of ISO/IEC 14882:1998 (Programming Language
C++) without necessarily adopting new C language features contained in
the current revision to ISO/IEC 9899:1990 (Programming Language C) or
any future revisions thereof.
ISO/IEC JTC 1/SC22 encourages WG14 and WG21 to continue their close
cooperation in the future.

Aug 10 '05 #6
Maxim Yegorushkin wrote:
msalters wrote:

It also states that these must be implemnted in some kind of binary
system, and that the ranges are at least (-127,127), (-32767,32767)
and so on. (by reference from C90)

C++ standard does not state that. C does indeed.


C90 imposes those minimum ranges through the requirements on CHAR_MIN,
etc. as specified in <limits.h>. C++ incorporates those requirements
through <climits>.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Aug 10 '05 #7

Pete Becker wrote:

[]
C++ standard does not state that. C does indeed.


C90 imposes those minimum ranges through the requirements on CHAR_MIN,
etc. as specified in <limits.h>. C++ incorporates those requirements
through <climits>.


Understood.

Aug 10 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Tony Jones | last post by:
Can anyone think of a reason why a 3rd party vendor writing .NET components would NOT strong name their assemblies? What harm does adding a strong-name to assembly present - I would think none...
43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
20
by: Razzie | last post by:
Hey all, I'm really going through a small hell right now - I've completely lost it :) I made a project, using two interop libraries from exchange (created them as in this msdn article:...
10
by: Tony Jones | last post by:
Can anyone think of a reason why a 3rd party vendor writing .NET components would NOT strong name their assemblies? What harm does adding a strong-name to assembly present - I would think none...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.