473,750 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

32 or 64 bit processor info in C

Hello,

Is there a way in C to get information at runtime if a processor is 32
or 64 bit?

Cheers,

Broeisi

Apr 10 '07
168 7260
Malcolm McLean wrote:
>
Though mainframes are an important part of the computing world, they
tend to be staffed by teams of professional programmers, and run
software specially written for them. The programs installed and the data
run through them can be strictly controlled.
I built my first 64 bit desktop system over 10 years ago and I still use
it. You are still deliberately avoiding the fact that 64 bit, LL64 and
more the more common LP64 systems have been in widespread use for a long
time, it's too late to start whinging now.

--
Ian Collins.
Apr 22 '07 #161
"Ian Collins" <ia******@hotma il.comwrote in message
news:59******** *****@mid.indiv idual.net...
Malcolm McLean wrote:
>>
Though mainframes are an important part of the computing world, they
tend to be staffed by teams of professional programmers, and run
software specially written for them. The programs installed and the data
run through them can be strictly controlled.

I built my first 64 bit desktop system over 10 years ago and I still use
it. You are still deliberately avoiding the fact that 64 bit, LL64 and
more the more common LP64 systems have been in widespread use for a
long time, it's too late to start whinging now.
Exactly. You built it. Hobbyists or people with special requirements do
that. Most people don't have the interest or the ability.
It is not too late. At the moment 2GB is enough for anyone, but that is
going to change when people start using PCs to watch telly, and we'll see 64
bit machines with 64GB+ coming on to the market. Now is the time to get 64
bit ints so we can write games for them.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Apr 22 '07 #162
Malcolm McLean wrote:
"Ian Collins" <ia******@hotma il.comwrote:
>>
I built my first 64 bit desktop system over 10 years ago and I still use
it. You are still deliberately avoiding the fact that 64 bit, LL64 and
more the more common LP64 systems have been in widespread use for a
long time, it's too late to start whinging now.
Exactly. You built it. Hobbyists or people with special requirements do
that. Most people don't have the interest or the ability.
You just don't get it do you? I built it because I always build my own
systems. The parts were off the shelf. I could just as well have got a
system off the shelf, or borrowed one of the several hundred we had in
our building at work.
It is not too late. At the moment 2GB is enough for anyone, but that is
going to change when people start using PCs to watch telly,
Start? I do it all the time...
and we'll
see 64 bit machines with 64GB+ coming on to the market.
They've been there for many years.
Now is the time
to get 64 bit ints so we can write games for them.
No, its not. It's too late. The key decisions were made nigh on 20
years ago. This has nothing to do with C and everything to do with
operating system suppliers.

--
Ian Collins.
Apr 22 '07 #163
Malcolm McLean wrote:
>
.... snip ...
>
In a consumer environment things are very different. Small
companies are trying to write software with very limited resources
which will be run on hardware they can't exactly specify, and will
have to exchange data with programs they know nothing about. If
there is a bug you don't have a list of installations and an
agreed patch schedule. If Microsoft decide that your compiler will
no longer run of Windows Vista, you have no choice but to run the
code through a different compiler.
Nonsense. You just go out and replace Vista. See below.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline.net

--
Posted via a free Usenet account from http://www.teranews.com

Apr 22 '07 #164
Malcolm McLean wrote, On 22/04/07 09:31:
>
"Flash Gordon" <sp**@flash-gordon.me.ukwro te in message
news:hj******** ****@news.flash-gordon.me.uk...
>Malcolm McLean wrote, On 21/04/07 17:45:
>>Most architectures don't distinguish between address and data integer
registers,

Most that you have come across possibly, but I doubt that you have
come across most architectures.
There is an interesting social factor here. Virtually everyone has
access to a PC,
Apart from being wrong in assuming virtually everyone has access to s PC
(large number of people do not) all the PCs you can buy off the shelf
have several processors and you are only thinking about one of them.
quite a high proportion of them have a C compiler
installed.
Since Windows does not come with a C compiler and most computer users
are not interested in programming I think it highly likely that by far
the majority do not have a C compiler installed.
Quite a lot of programmer never need to touch another
platform.
A significant number yes, but I'm not convinced it is the majority.
So those who program other devices consider themselves to be
superior beings.
No. At least, none I've met, and the first 15 years of my career was
mainly working with such people and being one.
Few people if any program every architecture.
I doubt that anyone programs for all architectures since there are far
too many.
However as it happens I am
one of the superior beings.
You have shown no sing of superior knowledge or ability.
so it makes sense to use the same registers to hold pointers
and ints.

It is not simply the width of the address register that is important,
it is also the memory bandwidth. Since memory is slow using 64 bit
integers when you do not need them can slow things significantly.
That is a good argument. You could of course always say that it is up to
the programmer to use a shorter type if he wants performance,
That would be a very stupid attitude since smaller types are often slower.
or you
could take the ANSI route and make everything take and return a size_t,
You seem to being deliberately stupid. There are lots of things which
are nothing to do with indexing or array sizes.
so that sizeof int is irrelevant.
If you stick within the limits of what the C standard guarantees it is
irrelevant, if you make non-portable assumptions about it then it is not.
But the reality is that most people
will use a kludge of ints and other types.
You are the only person here who seems to think it is a kludge.
So is speed more important
than code falling over for large arrays and easy interfacing?
I've never had code fall over for large arrays and the beauty of using
specific types for different things is that it makes interfacing easy,
you just use the correct type for what you are doing.
How much
speed are we talking about?
Well, in a paper someone else posted a link to in this thread that
explained why 32 bit ints were being selected it said that it was a
large impact.
As I said, engineering is like that.
Normally there are some good arguments for the opposite decision.
Have you ever considered that the reason everyone in this thread seems
to disagree with you about this is that you might be wrong about what
you think is best?
--
Flash Gordon
Apr 22 '07 #165
In article <a4************ *************** ***@bt.com>,
Malcolm McLean <re*******@btin ternet.comwrote :
>It is not too late. At the moment 2GB is enough for anyone,
I know some people with home machines with over 2GB. Photo work is
key for some of those.
>but that is
going to change when people start using PCs to watch telly,
My wife watched telly on my 512 MB PC for a while; eventually I was
driven to drop more memory into it, but that's because I had several
competing background computations running, and several anti-spyware
or anti-virus running, and everything together was driving the machine
to swap. The telly program itself was less than 10 MB for the
executable and DLLs, and not particularily memory hungry in operation.
>and we'll see 64
bit machines with 64GB+ coming on to the market.
>Now is the time to get 64
bit ints so we can write games for them.
There was an interesting interview in Toms Hardware (actually,
TwitchGuru) not long ago, with one of the successful game developers.
He doesn't consider PCs to be a viable part of the games market, and
believes standardization in the console market is the desirable future
-- and consoles are, of course, special purpose embedded markets with
dedicated teams of programmers, etc., all the things you use an excuse
to justify the success of the LLP64 (int 32) products in the last
decade. Why not PCs? It isn't because of int size issues: it's because
of the lack of "agreed-upon standard for processing power, pixel
throughput, storage devices and Internet connections.". Too much work,
in other words, to generalize the games for the existing PC *hardware*
anarchy.
http://www.twitchguru.com/2007/04/17...off/page2.html
--
Programming is what happens while you're busy making other plans.
Apr 22 '07 #166
"Malcolm McLean" <re*******@btin ternet.comwrite s:
>At the moment 2GB is enough for anyone,
I do research on virtual machines. 2 GB is enough to get
started, when you have a few virtual machines running, but memory
requirements go up very quickly.
--
"Some programming practices beg for errors;
this one is like calling an 800 number
and having errors delivered to your door."
--Steve McConnell
Apr 22 '07 #167
On Apr 21, 8:54 pm, Eric Sosman <esos...@acm-dot-org.invalidwrot e:
How many ways can you say "out of memory?" More than one,
I'm sure. A few possibilities:

- "Out of memory" (the basic bleat)

- "Memory quota exceeded" (maybe if the user petitions the
sysadmin for an increased quota all will be well)

- "No more swap space" (maybe if more swap can be allocated
all will be well)

- "Resource temporarily unavailable" (yes, I've seen this one)

- "No error" (I've seen this one, too)

... and probably others, too. The point is that a library function
may have several reasons for failing, and different reasons may
suggest different responses or corrections. IMHO it's better to
pass along whatever diagnostic information the implementation is
willing to provide than to throw a blanket over it and force the
user to guess about the reasons. Sometimes the diagnostic data is
misleading ("malloc: connection reset by peer"), but when it isn't
it can be most helpful.
OK... so maybe the solution would be to explicitly clear errno before
each call to malloc? Sounds tedious to do consistently :(
--
Eric Sosman
esos...@acm-dot-org.invalid

Apr 22 '07 #168
Fr************@ googlemail.com writes:
On Apr 21, 8:54 pm, Eric Sosman <esos...@acm-dot-org.invalidwrot e:
> How many ways can you say "out of memory?" More than one,
I'm sure. A few possibilities:

- "Out of memory" (the basic bleat)

- "Memory quota exceeded" (maybe if the user petitions the
sysadmin for an increased quota all will be well)

- "No more swap space" (maybe if more swap can be allocated
all will be well)

- "Resource temporarily unavailable" (yes, I've seen this one)

- "No error" (I've seen this one, too)

... and probably others, too. The point is that a library function
may have several reasons for failing, and different reasons may
suggest different responses or corrections. IMHO it's better to
pass along whatever diagnostic information the implementation is
willing to provide than to throw a blanket over it and force the
user to guess about the reasons. Sometimes the diagnostic data is
misleading ("malloc: connection reset by peer"), but when it isn't
it can be most helpful.

OK... so maybe the solution would be to explicitly clear errno before
each call to malloc? Sounds tedious to do consistently :(
If you're going to use the value of errno, you should *always* set it
to 0 before calling the function of interest.

--
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."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Apr 23 '07 #169

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

Similar topics

5
5237
by: dba_db2 at nospam gmx.net | last post by:
We have got a brand new mutltiprocessor machine IBM pseries server with 2 processors. Now we want to buy a IBM DB2 license for this box. Does anyone know whether it is possible to buy a single processor db2 license for this machine and to configure the db2 software with db2licm just to use one processor.
1
3476
by: Mateusz Rajca | last post by:
Hello, I would like to know how to find the specs of the current running system such as the memory amount and processor speed in C#? Mateusz
3
1441
by: Michel Meex | last post by:
Hello, I have an application, that has been running on a single processor server for more then a year without any problems. Now I'm migrating to a dual processor server, and I'm experiencing problems with threading. The application is actually a kind of job schedular. For all jobs, I can set a recurring interval (daily,weekly, monthly etc) at which the specific job should be started. We program each job, according to an interface....
1
1401
by: Michel Meex | last post by:
Hello, I have an application, that has been running on a single processor server for more then a year without any problems. Now I'm migrating to a dual processor server, and I'm experiencing problems with threading. The application is actually a kind of job schedular. For all jobs, I can set a recurring interval (daily,weekly, monthly etc) at which the specific job should be started. We program each job, according to an interface....
11
2320
by: sunil | last post by:
Dear All, I have created a .Net service in 2.0 and running it on a machine that has a Quad Processor. It is failing with the following error. "Error 1053: The service did not respond to the start or control request in a timely fashion" This is what I saw in event Viewer. Timeout (30000 milliseconds) waiting for the MyService Server service to connect.
5
6590
by: nano2k | last post by:
Hi I need to protect my application in a way. Just a "soft" protection, not a very strong one. So, using WMI I get the processor ID and compare it against a key. Protection works well, until someone (me) decides to clone the system. After cloning, all cloned systems work with the same key. That is, WMI returns the same processor id on all workstations. It seems that Windows "caches" the processor ID in the registry or somewhere else - I...
10
7009
by: WannaKatana | last post by:
I am just wondering why, with nothing else running and executing an update query against a very large table, does Access seem to be causing less than 10% processor usage. Then it says "There is not enough disk space or memory to undo the changes". I have 2 gb RAM, Core 2 duo e6300 processor and plenty of disk space. Why doesn't Access peg the CPU? Joel
11
6493
by: kyosohma | last post by:
Hi, We use a script here at work that runs whenever someone logs into their machine that logs various bits of information to a database. One of those bits is the CPU's model and speed. While this works in 95% of the time, we have some fringe cases where the only thing returned is the processor name. We use this data to help us decide which PCs need to be updated, so it would be nice to have the processor speed in all cases.
2
6178
by: raghavv | last post by:
Hi, I have developed a software.For licensing it i need to access a unique number of a computer like mother board id or processor id. Is there a way to get this info.In C# we can use system.management to get this info.Is there anything similar to this in java. If not How can i do this. Thank you...
0
8999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9394
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
9338
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
9256
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...
1
6803
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...
0
6080
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.