[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

2711.0. "How long is an 'int'?" by MARVIN::WALTER () Wed Jul 05 1989 09:25

	Can anyone tell me what is the usual length of an 'int' for
	the standard C compilers on the AMiga?

	I've been playing with PDC for a few months now, and despite its
	quirky bugs, it seems to work reasonably well. More recently, I've
	got a copy of the Sozobon (ZC) compiler. The problem with that, is that
	it uses 16 bit integers. 32 bit values have to be declared as 'long'
	or coerced to long  type. This is in contrast to PDC (and VAX/C of
	course!).

	I'd be interested to know what the other compilers do.
T.RTitleUserPersonal
Name
DateLines
2711.1ANT::JANZENcf. ANT::CIRCUITS,ANT::UWAVESWed Jul 05 1989 09:446
lattice c 5.0 defaults
        char is 1 byte
	int is 4 bytes
    float is 4 bytes.
    I think there is a long float that is 8 bytes.
    Tom
2711.2LEVERS::PLOUFFGlorious Blossoms -- Ah-ah-ah-choo!Wed Jul 05 1989 10:197
    Manx C 3.6a defaults
    	char is 1 byte
    	int is 2 bytes
    
    However, there is a compiler option and a complete set of libraries
    for 32-bit (i.e. 4-byte) ints, and many people use this option as
    standard procedure.
2711.3No standard about thatFROCKY::BOFFOTue Feb 06 1990 10:4215
    How long is an int ...
    
    You should write your programms that this does not make any difference.
    The only thing which is sure, is that 'long' is not smaller than 'short'.
    There is no further standard about that.
       
    If you need exactly 2 bytes take 'short int'. 
    If you need exactly 4 bytes take 'long int' or 'char[ 4 ]'.
    
    You can find out the lenght with:
    
    printf( "%d", sizeof( int ) );
    
    Thomas