473,503 Members | 11,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unsigned int support

faz
Dear all,

May i know the data type which can support FFFF FFFF FFFF
FFFF(18,446,744,073,709,551,615).I have declared a variable using
unsigned integer type which is supporting upto FFFF
FFFF(4,294,967,295).pls suggest me..

Thanks in advance,
faz

Aug 7 '07 #1
12 1889
On Aug 7, 9:01 am, faz <fazulu.v...@gmail.comwrote:
Dear all,

May i know the data type which can support FFFF FFFF FFFF
FFFF(18,446,744,073,709,551,615).I have declared a variable using
unsigned integer type which is supporting upto FFFF
FFFF(4,294,967,295).pls suggest me..

Thanks in advance,
faz
Sizes of datatypes and also the range of the values that they can
represent are implementation defined. The macros INT_MAX and UINT_MAX
defined in <climitswill let you know the maximum value an integral
type defined by your compiler.
-N

Aug 7 '07 #2
On Aug 7, 7:10 am, "Alf P. Steinbach" <al...@start.nowrote:
No, "long long" i's not yet part of the standard,
That depends which standard: it's in C99, in the current draft
C++ standard, and in every current C++ compiler I know of.
Unless you explicitly have to deal with older compilers (e.g.
VC++ 6.0), you can pretty much count on it.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Aug 7 '07 #3
Alf P. Steinbach wrote:
* James Kanze:
>On Aug 7, 7:10 am, "Alf P. Steinbach" <al...@start.nowrote:
>>No, "long long" i's not yet part of the standard,

That depends which standard: it's in C99, in the current draft
C++ standard, and in every current C++ compiler I know of.
Unless you explicitly have to deal with older compilers (e.g.
VC++ 6.0), you can pretty much count on it.

The standard for this group is the current C++ standard.

There's no "long long" in the standard.
But it has become ubiquitous and it is easy to test for.

--
Ian Collins.
Aug 7 '07 #4
Alf P. Steinbach wrote:
* Ian Collins:
>Alf P. Steinbach wrote:
>>* James Kanze:
On Aug 7, 7:10 am, "Alf P. Steinbach" <al...@start.nowrote:

No, "long long" i's not yet part of the standard,
That depends which standard: it's in C99, in the current draft
C++ standard, and in every current C++ compiler I know of.
Unless you explicitly have to deal with older compilers (e.g.
VC++ 6.0), you can pretty much count on it.
The standard for this group is the current C++ standard.

There's no "long long" in the standard.
But it has become ubiquitous and it is easy to test for.

T:\cat <bah.cpp
int main() { long long bah; }

T:\gnuc --version
g++ (GCC) 3.4.4 (mingw special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
T:\gnuc bah.cpp
bah.cpp: In function `int main()':
bah.cpp:1: error: ISO C++ does not support `long long'
bah.cpp:1: warning: unused variable 'bah'
So what ever "gnuc" is, it is invoking g++ in pedantic mode. You have
the choice of being pedantic, or pragmatic. If you had to do 64 bit
math, which would you prefer?

By easy to test for, I was thinking of something along the lines of

#include <limits.h>

int main() {
#if !defined ULLONG_MAX
# SomeBigIntClass bah;
#else
long long bah;
#endif
}

--
Ian Collins.
Aug 7 '07 #5
faz


I have tried this using VC++ 1998(older version)

int main()
{
long long bas;
return 0;

}
D:\Program Files\Microsoft Visual Studio\my projects\link list
\long.cpp(4) : error C2632: 'long' followed by 'long' is illegal
Error executing cl.exe.

long.obj - 1 error(s), 0 warning(s)

Not supported...I guess my compiler is 32-bit....Which compiler
support this??

regards,
faz

Aug 7 '07 #6
faz a écrit :
>
I have tried this using VC++ 1998(older version)

int main()
{
long long bas;
return 0;

}
D:\Program Files\Microsoft Visual Studio\my projects\link list
\long.cpp(4) : error C2632: 'long' followed by 'long' is illegal
Error executing cl.exe.

long.obj - 1 error(s), 0 warning(s)

Not supported...I guess my compiler is 32-bit....Which compiler
support this??
long long was introduced in C99. It is not really a surprise a compiler
didn't know about it in 98.

Michael
Aug 7 '07 #7
On 2007-08-07 00:14:05 -0400, Neelesh Bodas <ne***********@gmail.comsaid:
On Aug 7, 9:01 am, faz <fazulu.v...@gmail.comwrote:
>Dear all,

May i know the data type which can support FFFF FFFF FFFF
FFFF(18,446,744,073,709,551,615).I have declared a variable using
unsigned integer type which is supporting upto FFFF
FFFF(4,294,967,295).pls suggest me..

Thanks in advance,
faz

Sizes of datatypes and also the range of the values that they can
represent are implementation defined. The macros INT_MAX and UINT_MAX
defined in <climitswill let you know the maximum value an integral
type defined by your compiler.
Those macros give you the maximum values for int and unsigned int.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Aug 7 '07 #8
joe
On Aug 7, 6:45 am, faz <fazulu.v...@gmail.comwrote:
I have tried this using VC++ 1998(older version)

int main()
{
long long bas;
return 0;

}

D:\Program Files\Microsoft Visual Studio\my projects\link list
\long.cpp(4) : error C2632: 'long' followed by 'long' is illegal
Error executing cl.exe.

long.obj - 1 error(s), 0 warning(s)

Not supported...I guess my compiler is 32-bit....Which compiler
support this??

regards,
faz
As was briefly mentioned earlier, for earlier versions of VC, you want
the __int64 or unsigned __int64 type rather than long long. The more
recent versions of VC have added the long long type in anticipation of
the draft C++ standard.

joe

Aug 7 '07 #9
On Aug 7, 1:19 pm, Michael DOUBEZ <michael.dou...@free.frwrote:
faz a écrit :
I have tried this using VC++ 1998(older version)
int main()
{
long long bas;
return 0;
}
D:\Program Files\Microsoft Visual Studio\my projects\link list
\long.cpp(4) : error C2632: 'long' followed by 'long' is illegal
Error executing cl.exe.
long.obj - 1 error(s), 0 warning(s)
Not supported...I guess my compiler is 32-bit....Which compiler
support this??
long long was introduced in C99. It is not really a surprise a compiler
didn't know about it in 98.
Actually, it was introduced in one of the Unix standards long
before that. From what I understand, the ISO C committee didn't
particularly like it; what do you write in ten years time, for
128 bit ints: long long long? But even at the time the 1999
standard was being finalized (1997 or before), it was too
ubiquious to be ignored.

In the case of Visual Studios, of course, the Unix standards
aren't applicable, and VC++ actually did something more
intelligent, defining a type _int64 (which extends in a rather
obvious fashion, *and* is sort of in the implementation
namespace, although as a keyword, it really needs two
underscores). Also, compilers have a certain lead time as well,
and it wasn't at all clear that those opposing long long in C99
wouldn't have their way until fairly late in the standardization
process, so all Microsoft can be accused of here is not
respecting the Unix standards.

Once C formally adopted it, of course, it was fairly obvious
that C++ would follow suite (as it has). I think it safe to say
that any C++ compiler less than three or four years old should
support it. (I still use GB_longlong and GB_ulonglong, though.
Types defined in a system dependant header. Just in case I run
into an older compiler.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Aug 7 '07 #10
On Aug 7, 11:08 am, "Alf P. Steinbach" <al...@start.nowrote:
* James Kanze:
On Aug 7, 7:10 am, "Alf P. Steinbach" <al...@start.nowrote:
No, "long long" i's not yet part of the standard,
That depends which standard: it's in C99, in the current draft
C++ standard, and in every current C++ compiler I know of.
Unless you explicitly have to deal with older compilers (e.g.
VC++ 6.0), you can pretty much count on it.
The standard for this group is the current C++ standard.
The standard for this group is "portable C++", whatever that
means. Depending on your exact portability requirements, it
would be stupid not to use it. Or to use it, depending, as I
said, on your portability requirements.
There's no "long long" in the standard.
Depends on which standard.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Aug 7 '07 #11
On Aug 7, 1:23 pm, Pete Becker <p...@versatilecoding.comwrote:
On 2007-08-07 00:14:05 -0400, Neelesh Bodas <neelesh.bo...@gmail.comsaid:
On Aug 7, 9:01 am, faz <fazulu.v...@gmail.comwrote:
Dear all,
May i know the data type which can support FFFF FFFF FFFF
FFFF(18,446,744,073,709,551,615).I have declared a variable using
unsigned integer type which is supporting upto FFFF
FFFF(4,294,967,295).pls suggest me..
Sizes of datatypes and also the range of the values that they can
represent are implementation defined. The macros INT_MAX and UINT_MAX
defined in <climitswill let you know the maximum value an integral
type defined by your compiler.
Those macros give you the maximum values for int and unsigned int.
It might also be worth pointing out that you can easily test for
long long by means of such macros:

#include <limits.h>
#ifdef LLONG_MAX
typedef long long MyLongLong ;
#else
???
#endif

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Aug 7 '07 #12

Jim Langston <ta*******@rocketmail.comwrote in message...
"Ian Collins" <ia******@hotmail.comwrote in message...
>
Or rather the OP needs (unsigned) long long, which often does not
require a 64 bit compiler (whatever that might be).

I don't think that unsigned long long is guaranteed to be 64 bit in all
implentations, is it?
Soon! GNU's had it for a while. <G>

[ GCC(MinGW)3.3.1, win98se, iP4]
// #include <limits>

std::cout <<" LL digits ="
<<(std::numeric_limits<long long>::digits)<<std::endl;
// LL digits =63

std::cout <<" ULL digits ="
<<(std::numeric_limits<unsigned long long>::digits)<<std::endl;
// ULL digits =64

std::cout<<" LD digits ="
<<(std::numeric_limits<long double>::digits)<<std::endl;
// LD digits =64

--
Bob R
POVrookie
Aug 7 '07 #13

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

Similar topics

20
4663
by: barbara | last post by:
Hi, all I have to read a binary data which is four bytes and I need to use the following function to deal with data: Private Function BIT(ByVal Val As UInt32, ByVal BitNum As UInt32) As...
5
4977
by: Mitchell S. Honnert | last post by:
I'm thinking about adding unsigned types, like UShort and UInt, to a VB.NET library that I published which edits ID3 tag information. It would make the interface much more clean to have some...
42
7336
by: sarathy | last post by:
Hi, I need clarification regarding signed characters in the C language. In C, char is 1 byte. So 1. Unsigned char - ASCII CHARACTER SET - EXTENDED CHARACTER SET
3
4054
by: wenmang | last post by:
Hi, I encountered a problem involving storage of unsigned long long. The requirement of incoming data field is an unsigned 64-bit integer, but on our system, due to lack of support of 64-bit...
24
10408
by: Paulo Matos | last post by:
Hello, Is it safe to assume a size_t is an unsigned long? (is it forced by the standard?) Thank you, Paulo Matos
17
1632
by: Army1987 | last post by:
If uMyInt_t is an unsigned integral type, is the following a necessary and sufficient condition that uMyInt_t has no trap representation? (uMyInt_t)(-1) >CHAR_BIT*sizeof(uMyInt_t)-1 That is,...
14
12268
by: moumita | last post by:
Hi All, I need to convert 4 bytes to an unsigned long. Suppose I have one array like unsigned char buf.I need to convert these 4 bytes into a single unsigned long. Is the following piece of code...
33
15452
by: Michael B Allen | last post by:
Hello, Early on I decided that all text (what most people call "strings" ) in my code would be unsigned char *. The reasoning is that the elements of these arrays are decidedly not signed. In...
4
4302
by: Sam | last post by:
Hi, I am using some functions return a base64 encoded string. The functions write it into an unsigned char buffer. I am a little confused as to why a base64 encoded string would be using an...
30
4821
by: viza | last post by:
Hi all int i= INT_MIN; unsigned int u= -i; Is u guaranteed to have the absolute value of INT_MIN? Why it might not: -i has type (int), and -INT_MIN might be more than INT_MAX.
0
7207
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
7095
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
7294
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
7361
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...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
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
4693
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
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
403
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.