473,385 Members | 1,782 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,385 software developers and data experts.

are there systems where int is unsigned

Hi,

my question is limited to moderm and powerfull architectures (we do
simulation and solve large systems of linear equations).

Are there any architectures arround where an int is unsigned? I have in
my mind that this is not defined by the standard - right?

I also found no list which gives the types for different architectures/
compilers.

Thanks,

Fabian
Mar 1 '07 #1
5 1781
Fabian Wein wrote:
my question is limited to moderm and powerfull architectures (we do
simulation and solve large systems of linear equations).

Are there any architectures arround where an int is unsigned? I have
in my mind that this is not defined by the standard - right?
What is not defined? That 'int' is signed? Yes, it *is* defined.
The "int" is one of the four "signed integer types" (3.9.1/2).
I also found no list which gives the types for different
architectures/ compilers.
Not sure what you're looking for and why. Care to rephrase?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 1 '07 #2
Hi Victor,
What is not defined? That 'int' is signed? Yes, it *is* defined.
The "int" is one of the four "signed integer types" (3.9.1/2).
thanks for answer!
>I also found no list which gives the types for different
architectures/ compilers.
Not sure what you're looking for and why. Care to rephrase?
In our project all types are wrapped, so we have

typedef Double double;
typedef Complex std::complex<double>;
typedef Int ...
typedef UInt ...

I doubt that this makes sense but on the other side I don't know
what an "int" is on - let's say

Opteron with gcc
Itanium with icc
ppc with ???

Now I know for sure that "int" is not unsigned - thanks :)

I guess double is fixed to 64 bits?

BTW, what is a good online ressource? I normally use cppreference.com

Fabian
Mar 1 '07 #3
Fabian Wein wrote:
Hi Victor,
>What is not defined? That 'int' is signed? Yes, it *is* defined.
The "int" is one of the four "signed integer types" (3.9.1/2).
thanks for answer!
>>I also found no list which gives the types for different
architectures/ compilers.
Not sure what you're looking for and why. Care to rephrase?

In our project all types are wrapped, so we have

typedef Double double;
You mean, reversed, no doubt:

typedef double Double;
typedef Complex std::complex<double>;
typedef std::complex<doubleComplex;
typedef Int ...
Presuming

typedef ... Int;

, what's there in the "..."?
typedef UInt ...

I doubt that this makes sense
Unless you can explain, I am not going to guess.
but on the other side I don't know
what an "int" is on - let's say

Opteron with gcc
Itanium with icc
ppc with ???
Quoting the Standard: "Plain ints have the natural size suggested
by the architecture of the execution environment". IOW, 'int' is
for signed integer arithmetic and it's the best choice for it, no
matter where your program is running.

You can learn its size in bytes by using 'sizeof'. You can learn
its size in bits by multiplying the size in bytes by CHAR_BITS.
You can learn other properties from 'std::numeric_limits<int>'.

If you need some kind of abstraction layer between your arithmetic
operations in your C++ code and the underlying system providing
the actual implemenation, it might make sense. For examle, CGAL
folks have several numeric engines implemented (including the plain
ol' FP types).
Now I know for sure that "int" is not unsigned - thanks :)

I guess double is fixed to 64 bits?
No, it isn't.
BTW, what is a good online ressource? I normally use cppreference.com
I use www.google.com.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 1 '07 #4
On Mar 1, 3:43 pm, Fabian Wein <f...@lse.e-technik.uni-erlangen.de>
wrote:
I guess double is fixed to 64 bits?
Nope, but you might be interested in the defines in <cfloat>, the
closes you can come to the number of bits of a double seems to be the
number of bits in the mantissa: DBL_MANT_DIG.
BTW, what is a good online ressource? I normally use cppreference.com
A copy of the standard is nice, if you don't want to buy one you can
use a draft of the standard, google for WG21, first hit, click on
papers and look around. Try to find a draft from just before or after
it was standardized and you should be close enough on most things.

www.cplusplus.com/reference/ might also be of interest, mainly for the
IO-part of the library.

--
Erik Wikström

Mar 1 '07 #5
Erik Wikström wrote:
On Mar 1, 3:43 pm, Fabian Wein <f...@lse.e-technik.uni-erlangen.de>
wrote:
>I guess double is fixed to 64 bits?

Nope, but you might be interested in the defines in <cfloat>, the
closes you can come to the number of bits of a double seems to be the
number of bits in the mantissa: DBL_MANT_DIG.
Or see 'std::numeric_limits<double>' members.
>BTW, what is a good online ressource? I normally use cppreference.com

A copy of the standard is nice, if you don't want to buy one you can
use a draft of the standard, google for WG21, first hit, click on
papers and look around. Try to find a draft from just before or after
it was standardized and you should be close enough on most things.

www.cplusplus.com/reference/ might also be of interest, mainly for the
IO-part of the library.
Usually nothing beats the documentation that comes with your compiler,
unless it's one of those "free" compilers. Unfortunately, the Standard
only can tell you how something *should* be implemented, and it's not
always the way it's implemented in your compiler[s].

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 1 '07 #6

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

Similar topics

12
by: Bill Hanna | last post by:
C is inadequate for embedded systems for the following reasons: 1) Direct addressing of memory mapped I/O is not supported simply and easily. You have to find work-arounds that are compiler...
54
by: Matt | last post by:
How do we define systems programs? when we say systems programming, does it necessary mean that the programs we write need to interact with hardware directly? For example, OS, compiler, kernel,...
6
by: Javier | last post by:
Hello people, I'm recoding a library that made a few months ago, and now that I'm reading what I wrote I have some questions. My program reads black and white images from a bitmap (BMP 24bpp...
14
by: Martin Wells | last post by:
When I want to store a number, I use "unsigned". I go with unsigned because it's the natural type for the system, and so should be the fastest. However, there are 8-Bit microcontrollers out...
20
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
There are a few guarantees I exploit in the C Standard. For instance, I might write (unsigned)-1 to get the maximum value for an unsigned integer. Also, I might rely on things such as: ...
30
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Let's say we had a simple function for returning the amount of days in a month: unsigned DaysInMonth(unsigned const month) { switch (month) { case 8: case 3: case 5:
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.