| 
 | 
 | 
 
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Time for little quiz! 
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: Time for little quiz! [message #17891 is a reply to message #2295] | 
			Tue, 02 September 2008 00:04    | 
		 
		
			
				
				
				
					
						  
						nixnixnix
						 Messages: 415 Registered: February 2007  Location: Kelowna, British Columbia
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		ok I am not quite up to understanding the full consequences of the above conversation. However, the bit (excuse the pun) that interests me is: 
 
how many bits does an "int" have when I compile on a 64 bit OS (linux or vista - I am trying both)? 
 
If I want my documents to load and save (using Serialize(Stream&)) between 32 and 64 bit implementations of my software, do I need to replace all "int" with "int32"? I am guessing this is so but what else will I need to change please? 
 
char is still 16 bit right? 
float is always 32 bit right? 
double is always 64 bit right? 
what about bool? 
what about String? 
 
Nick
		
		
		[Updated on: Tue, 02 September 2008 00:06] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: Time for little quiz! [message #17892 is a reply to message #17891] | 
			Tue, 02 September 2008 08:56    | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		[quote title=nixnixnix wrote on Mon, 01 September 2008 18:04]ok I am not quite up to understanding the full consequences of the above conversation. However, the bit (excuse the pun) that interests me is: 
 
how many bits does an "int" have when I compile on a 64 bit OS (linux or vista - I am trying both)? 
 
If I want my documents to load and save (using Serialize(Stream&)) between 32 and 64 bit implementations of my software, do I need to replace all "int" with "int32"? I am guessing this is so but what else will I need to change please? 
[quote] 
 
It "depends". 
 
With x86-64, int is still 32 bits. And in fact, AFAIK, this is the most common arrangement for 64-bit systems. 
 
To get "true" 64-bit integer, types vary more, but with U++, you can just use "int64". 
 
| Quote: |  
  
char is still 16 bit right? 
  |  
  
 
char is always 8 bit. 
 
wchar is now 16 bit, but it seems like we have to go 32-bit soon. But that should not affect the existing code too much. 
 
| Quote: |  
  
float is always 32 bit right? 
double is always 64 bit right? 
  |  
  
 
Yes. 
 
 
 
Frankly, I do not know   But I believe it is 1 for both GCC and MSC. 
 
| Quote: |  
  
what about String? 
  |  
  
 
Current implementation 16. May change (before 2007, it was equal to sizeof(void*)). 
 
Mirek
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 12:44:06 CET 2025 
 Total time taken to generate the page: 0.23414 seconds 
 |   
 |  
  |