473,666 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's wrong with long long?

I use long longs occasionally. I know there are some limitations regarding
the standards such as not using long long constants but what's the big
deal? Why is long long not used so much?

Mike
Nov 14 '05 #1
24 1872
Michael B Allen wrote:
I use long longs occasionally. I know there are some limitations regarding
the standards such as not using long long constants but what's the big
deal? Why is long long not used so much?

Mike


I've played with long long but I don't remember using it in a
program. I'm sure that if programming problem arises that requires
integers larger than +-2 or +4 billion, I will use long long quite
naturally.
--
Joe Wright mailto:jo****** **@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #2

"Michael B Allen" <mb*****@ioplex .com> wrote in message
news:pa******** *************** *********@iople x.com...
I use long longs occasionally. I know there are some limitations regarding
the standards such as not using long long constants but what's the big
deal? Why is long long not used so much?

Some people are still using Microsoft compilers which reject long long.
Apparently, MS are using macros such as ULONG64 in some of their headers.
I've asked some of their fans about the rationale for this, and got total
silence as an answer. long long appears to have reached full citizenship in
the recent round of MS road shows.
I have a version of their compiler which does support long long, and yet is
to be obsoleted at the end of the year, along with those which don't. Are
you implying that none of the Microsoft compilers support long long
constants? It's true that MS compilers may not take long constants as long
long.
Would you care to bet on the likelihood of people who still claim that long
long isn't standard changing their mind 6 months from now when MS stops
"supporting " compilers which reject it?
Nov 14 '05 #3

"Michael B Allen" <mb*****@ioplex .com> wrote in message

Why is long long not used so much?

A number must ultimately represent something in the real world. You seldom
need a number above 4 billion, which is about the number of adults in the
world. An exception is memory size, which can exceed 4GB on large systems
and may soon be around that on desktop PCs, but in C we use size_t for
amounts of memory.
Nov 14 '05 #4

"Malcolm" <ma*****@55bank .freeserve.co.u k> wrote in message
news:ca******** **@news6.svr.po l.co.uk...

"Michael B Allen" <mb*****@ioplex .com> wrote in message

Why is long long not used so much?

A number must ultimately represent something in the real world. You seldom
need a number above 4 billion, which is about the number of adults in the
world. An exception is memory size, which can exceed 4GB on large systems
and may soon be around that on desktop PCs, but in C we use size_t for
amounts of memory.

This will change soon as we move to IPv6. Networking will be one
application where >32bit numbers are required.

Dan
Nov 14 '05 #5
"Dan P." <dp************ ***@ec.rr.com> writes:
"Malcolm" <ma*****@55bank .freeserve.co.u k> wrote in message
news:ca******** **@news6.svr.po l.co.uk...

"Michael B Allen" <mb*****@ioplex .com> wrote in message

Why is long long not used so much?

A number must ultimately represent something in the real world. You seldom
need a number above 4 billion, which is about the number of adults in the
world. An exception is memory size, which can exceed 4GB on large systems
and may soon be around that on desktop PCs, but in C we use size_t for
amounts of memory.

This will change soon as we move to IPv6. Networking will be one
application where >32bit numbers are required.


An IPv6 address is 128 bits, but I don't think it's typically
represented as a single number. I don't know of any systems that
directly support 128-bit integers anyway. (Counterexample s would not
contradict my main point.)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #6
Keith Thompson wrote:
"Dan P." <dp************ ***@ec.rr.com> writes:

.... snip ...

This will change soon as we move to IPv6. Networking will be
one application where >32bit numbers are required.


An IPv6 address is 128 bits, but I don't think it's typically
represented as a single number. I don't know of any systems
that directly support 128-bit integers anyway. (Counterexample s
would not contradict my main point.)


That should last throught the first Galactic Empire and the fall
of Trantor :-)

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!

Nov 14 '05 #7
On Sun, 13 Jun 2004 15:05:48 +0100, "Malcolm"
<ma*****@55bank .freeserve.co.u k> wrote in comp.lang.c:

"Michael B Allen" <mb*****@ioplex .com> wrote in message

Why is long long not used so much?

A number must ultimately represent something in the real world. You seldom
need a number above 4 billion, which is about the number of adults in the
world. An exception is memory size, which can exceed 4GB on large systems
and may soon be around that on desktop PCs, but in C we use size_t for
amounts of memory.


What an absurd line of reasoning. Are you actually this clueless, or
just trolling?

On a heavy trading day on the US stock exchanges, the number of shares
traded on the NASDAQ exchange can exceed the maximum value of a signed
32-bit long int.

I seem to recall, but can't be bothered to look up, that there have
been days when the sum of shares traded on the AMEX and NASDAQ
exchanges exceeded the maximum value of an unsigned 32-bit long.

Not to mention the fact that a large number of simple mathematical and
statistical algorithms, often most efficiently implemented with
integer math, require raising numbers to the second power. The range
of the second power of numbers that fit in a 32-bit integer type most
certainly will not fit in anything less than a 64-bit integer type.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #8
In article <s0************ *************** *****@4ax.com>,
Jack Klein <ja*******@spam cop.net> wrote:
Not to mention the fact that a large number of simple mathematical and
statistical algorithms, often most efficiently implemented with
integer math, require raising numbers to the second power. The range
of the second power of numbers that fit in a 32-bit integer type most
certainly will not fit in anything less than a 64-bit integer type.


I think in one of Donald Knuth's book there was a trick question: What
is the fastest algorithm to calculate n raised to the 19th power? The
answer was: Since the result must fit into n bits, the argument can be
at most (some tiny number), so the fastest method is a lookup-table...
Nov 14 '05 #9

"Jack Klein" <ja*******@spam cop.net> wrote in message
On Sun, 13 Jun 2004 15:05:48 +0100, "Malcolm"
<ma*****@55bank .freeserve.co.u k> wrote in comp.lang.c:
What an absurd line of reasoning. Are you actually this clueless, > or just trolling?
On a heavy trading day on the US stock exchanges,

So you've come up with another exception. No-one is claiming that never ever
will you need a number over 4 billion. Clearly, if you need to give an id
number to the entire population of the world, or you need to tag every US
cent in circulation, or you are doing some fancy statistical work that
generates large integers, then these are exceptions. However the exceptions
don't arise very often, which is why you will seldom see long long used in
real programs.
Nov 14 '05 #10

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

Similar topics

0
3796
by: Fabster | last post by:
Below is a code part I got somewhere and works fine for retrieving a version from a single file. Now I want to retrieve all .dll, .ocx and ..exe file versions from my harddisk in all directory's. I generate a array of all those files and then in a loop request the version for each of those files. Now it randomly crashes with a error that it cannot write to memory at location xxxxxx. I cannot find the error and adding 'on error goto...
125
14706
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
46
4198
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do believe MSFT should do to improve C#, however. I know that in the "Whidbey" release of VS.NET currently
8
3144
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that basically entitled to us to just about every .Net development tool you can imagine. I cant even begin to mention them. To begin with, my background is not that of a programmer, but a systems engineer and the closest I have come to "programming"...
10
3222
by: Protoman | last post by:
Could you tell me what's wrong with this program, it doesn't compile: #include <iostream> #include <cstdlib> using namespace std; class Everything { public: static Everything* Instance()
31
383
by: Cesar Rodas | last post by:
Hello to all As far I know the unsigned char just use 1-byte, long 4-bytes... is this right??? Well I have the next code... #include <stdio.h> #include <stdlib.h>
15
9022
by: robert maas, see http://tinyurl.com/uh3t | last post by:
Here's the source: #include <stdio.h> #include <errno.h> main () { char* str = "9999999999"; long long int llin; char* endptr; /* Set by strtoll */ int nch; errno = 0; llin = strtoll(str, &endptr, 10); printf("errno=%d\n", errno);
22
2026
by: davy.zou | last post by:
I found the code for a program that is suppose to be able to work out the sumation of i from 1 to a certain integer n. however, when I implemented to code into Visual C++, it doesn't work. The original sample code provided by the website: unsigned int Sum (unsigned int n) { unsigned int result = 0; for (unsigned int i=1; i<=n; i++) { result+=1;
92
6187
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
10
2051
by: questions | last post by:
# include <stdio.h> # include <math.h> int main() { long int x,y; printf("enter an integer\n"); scanf("%d",&x); y=x%pow(10,3);
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2771
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 we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.