Difference between revisions of "Pascal for C users"

From Free Pascal wiki
Jump to navigationJump to search
Line 120: Line 120:
 
!   [[Pascal]] [[Data_type|type]]  
 
!   [[Pascal]] [[Data_type|type]]  
 
!   Size (bits)  
 
!   Size (bits)  
 +
!   Range  
 +
!  
 
|-
 
|-
 
|   char  
 
|   char  
 
|   [[Char]]  
 
|   [[Char]]  
 
|   8-bit
 
|   8-bit
 +
|  
 +
|   [[ASCII]]
 
|-
 
|-
 
|   signed char  
 
|   signed char  
 
|   [[Shortint]]
 
|   [[Shortint]]
 
|   8-bit
 
|   8-bit
 +
|   -128 .. 127
 +
|  
 
|-
 
|-
 
|   unsigned char  
 
|   unsigned char  
 
|   [[Byte]]
 
|   [[Byte]]
 
|   8-bit
 
|   8-bit
 +
|   0 .. 255
 +
|  
 
|-
 
|-
 
|   char*  
 
|   char*  
 
|   [[PChar]]
 
|   [[PChar]]
 
|   (32-bit)
 
|   (32-bit)
 +
|
 +
|   Pointer to a null-terminated string  
 
|-
 
|-
 
|   float  
 
|   float  
 
|   [[Single]]
 
|   [[Single]]
 
|   32-bit
 
|   32-bit
 +
|   1.5E-45 .. 3.4E+38  
 +
|
 
|-
 
|-
 
|   double  
 
|   double  
 
|   [[Double]]
 
|   [[Double]]
 
|   64-bit
 
|   64-bit
 +
|   5.0E-324 .. 1.7E+308  
 +
|
 +
 
|-
 
|-
 
|}
 
|}

Revision as of 19:16, 10 November 2007

  C     Pascal  
  {     Begin    
  }     End  
  =     :=   Becomes  
  ==     =   Equal
  /     /   Division (or sometimes div)  
  %     Mod  
  !     Not  
  !=     <>   Not equal  
  &&     And  
  ||     Or  
  ^     Xor  
  >>     Shr   bit shift right  
  <<     Shl   bit shift left  
  ++     Inc  
  --     Dec  
  /*     {  
  */     }  
  //     //  
  if()     If Then  
  if() else     If Then Else  
  while     While Do  
  do while     Repeat Until Not   
  do while !     Repeat Until    
  for ++     For To Do  
  for --     For Downto Do    
  switch case break     Case Of End  
  switch case break default     Case Of Else End    


  C type     Pascal type     Size (bits)     Range    
  char     Char     8-bit     ASCII
  signed char     Shortint   8-bit   -128 .. 127  
  unsigned char     Byte   8-bit   0 .. 255  
  char*     PChar   (32-bit)   Pointer to a null-terminated string  
  float     Single   32-bit   1.5E-45 .. 3.4E+38  
  double     Double   64-bit   5.0E-324 .. 1.7E+308