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

changing all int to int64

Hi,
the project we are working on uses "int" for all integral type data (i have
also declared size_t at some places where crt functions return size_t type).
Now our application has to deal with files larger than 4gb. Typical places
where my code will have to deal with more than 4gb data/figure is
calculating the sizes of files and storing them in some place, this can be
like 6 or 7 or more gb of figure. Breaking down the 6 or 7 gb archive file
into small blocks of say 500kb. I was about to make some changes in my code
to change int to int64 *where needed*, when somebody came up to me and said
"why dont you just find-and-replace all the int with int64, that way you
wont have to think about where you have to make changes and wont have to do
any debugging."
Now i want to knowm can/should i do this find-n-replace all int with int64?
I mean what i have in mind is why should I change all of my code to use in64
datatype where as only a small portion of my code requires that change. Plz
advise.

Regards,
..ab
Aug 12 '07 #1
3 1558
If it's not needed much, and you can keep track all the places to change it,
change just what you need.

If you can do a test version, and it's a hassle to find all the right places
to change it, you could change them all and see if there are any problems
(memory, speed).

If int is mostly used for counters and such it's probably not useful to
change. If they're used in loops, int is always the fastest for the
processor, where __int64 is just a bit slower on a 32-bit system I've never
noticed the speed difference to be significant, since speed depends more on
cache hits than on variable size.

You might want to use typedefs, so undoing changes is one line.
Aug 13 '07 #2
Thanks for the answer.

regards,
...ab

"Dave Heinemann" <Dave He*******@discussions.microsoft.comwrote in message
news:C2**********************************@microsof t.com...
If it's not needed much, and you can keep track all the places to change
it,
change just what you need.

If you can do a test version, and it's a hassle to find all the right
places
to change it, you could change them all and see if there are any problems
(memory, speed).

If int is mostly used for counters and such it's probably not useful to
change. If they're used in loops, int is always the fastest for the
processor, where __int64 is just a bit slower on a 32-bit system I've
never
noticed the speed difference to be significant, since speed depends more
on
cache hits than on variable size.

You might want to use typedefs, so undoing changes is one line.

Aug 13 '07 #3

"Abubakar" <s@s.comwrote in message
news:e8**************@TK2MSFTNGP03.phx.gbl...
Hi,
the project we are working on uses "int" for all integral type data (i
have also declared size_t at some places where crt functions return size_t
type). Now our application has to deal with files larger than 4gb. Typical
places where my code will have to deal with more than 4gb data/figure is
calculating the sizes of files and storing them in some place, this can be
like 6 or 7 or more gb of figure. Breaking down the 6 or 7 gb archive file
into small blocks of say 500kb. I was about to make some changes in my
code to change int to int64 *where needed*, when somebody came up to me
and said "why dont you just find-and-replace all the int with int64, that
way you wont have to think about where you have to make changes and wont
have to do any debugging."
Now i want to knowm can/should i do this find-n-replace all int with
int64? I mean what i have in mind is why should I change all of my code to
use in64 datatype where as only a small portion of my code requires that
change. Plz advise.
The person who made the suggestion does not sound like a programmer. Doing
a global find+replace will not save you from debugging and having to think.
For example, all your printf calls will be broken, you'll need to add casts
everywhere, etc.

Instead, make a typedef for fileoffset and change only the variables and
functions that deal with filesize. You'll also have to change which file
APIs you call, to use the larger variables.
>
Regards,
.ab


Aug 13 '07 #4

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

Similar topics

2
by: Pat | last post by:
Hi, I want to write a int64 data into a file using fprintf(). In the fprintf argument, which one (%d or %u or other) should be used? Thanks. Pat
6
by: ESOJAY | last post by:
Is "typedef long long int64" the best way to define an int64 type in c? Are there better alternatives? Thanks, ESOJAY -- ESOJAY
4
by: Simon Devlin | last post by:
Hi folks, I've been bashing my head against this all afternoon and am now totally baffled. Given this (a simple routine to turn a ip address string into an decimal) <snip> Dim Parts(3) as...
5
by: harishashim | last post by:
I have gone through necessary step and have been able to use a .Net libraries (created using C#) in VB6. It run good untill I try to use certain function in the library that is using Int64 type as...
10
by: Lau Lei Cheong | last post by:
Hello, I really need to use volatile System.Int64 for a .NET v1.1 program in C#. But the compiler complains "a volatile field can not be of type long". How to work around it? Or is there any...
14
by: cj | last post by:
VB2003. I need a large positive integer. Which is larger int64 or double? I see int64 also apparently is known as long and will hold -9,223,372,036,854,775,808 through...
12
by: Allen | last post by:
My C extension works wrong, and debug it, found that sizeof (INT64) = 4, not 8. I compile on Windows XP platform. Please tell me how to fix it to support INT64? Thanks.
2
by: Peter Larsen [] | last post by:
Hi, How do i combine two 32 bit integers into one int64 in .net/C# ?? BR Peter
3
by: Tim Sprout | last post by:
To convert hex to Int64 I can use: string hex = "413208A97245F5AE"; Int64 intFromHex = System.Convert.ToInt64(hex, 16); //intFromHex = 4697826885160531374 How do I reverse this, and convert...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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
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
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...

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.