Limits on 32 and 64 bit in C++ / C


 
Thread Tools Search this Thread
Top Forums Programming Limits on 32 and 64 bit in C++ / C
# 1  
Old 05-04-2017
Limits on 32 and 64 bit in C++ / C

Hi All,

I am getting below run time error

Quote:
Bytes_read 2147483647 - file position 2147483647 - stat size -1047828448
I checked the code and see the structure defined as below and using the file position variable

Code:
typedef struct Get_file {
        char            *current_pathname;
        unsigned int    tot_bytes_io, physical_position;
        int file_position;
        int             remote;
        char            host[12];
        int             fd, open_mode;

the variable is a integer . I looked the binary and it was 32 bit compiled and the integer limit the output is saying is that. I did the compile in 64 bit. But I still see the issue . I am not sure why 64 bit compilation is not working

Thanks
# 2  
Old 05-04-2017
This varies a bit among compilers, but in general, you get 64-bit types when you ask for them and otherwise are left with the same defaults as a 32-bit machine. Pointers of course become 64-bit on any architecture with a flat memory model.

Use size_t for sizes and positions, that's what it's there for. It will always be the right size of variable for whatever you're compiling on.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 05-05-2017
Hi.

To see arithmetic characteristics of compiler and machine, consider enquire:

Enquire: Everything you wanted to know about your C Compiler and Machine, but didn't know who to ask

Best wishes ... cheers, drl
This User Gave Thanks to drl For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies

2. UNIX for Dummies Questions & Answers

Soft and hard limits for nproc value in /etc/security/limits.conf file (Linux )

OS version : RHEL 6.5 Below is an excerpt from /etc/security/limits.conf file for OS User named appusr in our server appusr soft nproc 2047 appusr hard nproc 16384 What will happen if appusr has already spawned 2047 processes and wants to spawn 2048th process ? I just want to know... (3 Replies)
Discussion started by: kraljic
3 Replies

3. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

4. Red Hat

boot the 32 bit kernel on a 64 bit PPC Linux machine?

Hi all, I'm looking to cover a corner case for an upcoming test cycle. Is there a way to boot a RedHat Advanced Server 4 (update 3) installed on a Power PC machine to use a 32 bit kernel? This would be similar to what is done here -> https://www.unix.com/aix/26204-aix-platform.html I've done... (0 Replies)
Discussion started by: philrau
0 Replies

5. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies
Login or Register to Ask a Question