In Free Pascal ist dies die Standard-Compilereinstellung</td>
In Free Pascal ist dies die Compilerdirektive {$B ON}</td>
</tbody>
Bit Operatoren
C
Pascal
Kommentare
~
Not
Einerkomplement
&
And
bitweises UND
|
Or
bitweises inclusives ODER
^
Xor
bitweises exclusives ODER
>>
Shr
bitweises Rechtsschieben mit Vorzeichen
<<
Shl
bitweises Linksschieben
Zuweisungs Operatoren
Hinweis:
C-artige Operatoren werden in Free Pascal über die Kommandozeilenoption -Sc ermöglicht. C-artige Operatoren werden in Lazarus über die Projekteinstellungen ermöglicht.
{| class="wikitable" ! C !! Pascal !! Kommentare |- | = | := | Einfache Zuweisung |- | += | += | Additionszuweisung |- | -= | -= | Subtraktionszuweisung |- | *= | *= | Multiplikationszuweisung |- | /= | /= | Divisionszuweisung |- | %= | ist in Free Pascal nicht vorhanden | Modulo Zuweisung |- | &= | ist in Free Pascal nicht vorhanden | UND Zuweisung |- | |= | ist in Free Pascal nicht vorhanden | ODER Zuweisung |- | ^= | ist in Free Pascal nicht vorhanden | Exclusive ODER Zuweisung |- | >>= | ist in Free Pascal nicht vorhanden | Rechtsschiebe Zuweisung |- | <<= | ist in Free Pascal nicht vorhanden | Linksschiebe Zuweisung |}
Sonstige Operatoren
C
Pascal
&
@
Adresse von ...
*
^
Zeiger
Übersetzen von C Anweisungsblöcken
C
Pascal
Kommentare
{
Begin
Anfang eines Anweisungsblocks
}
End
Ende / Abschluss eines Anweisungsblocks
Übersetzen von C Kommentarzeichen
C
Pascal
Kommentare
/*
{
Anfang eines Kommentars
/*
(*
Anfang eines Kommentars
*/
}
Ende eines Kommentars
*/
*)
Ende eines Kommentars
//
//
Kommentarzeile
Übersetzen von C Schleifentypen
C
Pascal
Kommentare
for( ...; ...; ...++)
For ... To ... Do
Kopfgesteuerte Schleife, die hochgezählt wird
for(...; ...; ...--)
For ... Downto ... Do
Kopfgesteuerte Schleife, die heruntergezählt wird
while (...)
While ... Do
Kopfgesteuerte Schleife
do ... while(...)
Repeat ... Until
Fussgesteuerte Schleife
do ... while!(...)
Repeat ... Until ... Not
Fussgesteuerte Schleife mit Negation des Ergebnisses des Ausdrucks
Übersetzen von C Verzweigungen / Bedingungen
C
Pascal
Kommentare
if(...)
If ... Then
If-Bedingung
if(...) ... else
If ... Then ... Else
If-Bedingung mit Sonstzweig
switch(...) case ...: ... break;
Case ... Of ...: ... End
Case-Bedingung
switch(...) case ...: ... break; default ...;
Case ... Of ...: ... Else ... End
Case-Bedingung mit Sonst-Zweig
Übersetzen von C Verzweigungen- / Schleifenabbrüchen
C
Pascal
Kommentare
break
Break
Die break-Anweisung ermöglicht es, vorzeitig eine Schleife (oder ein switch-case-Konstrukt) zu verlassen
continue
Continue
Die continue-Anweisung ermöglicht es, den aktuellen Schleifendurchlauf zu beenden
Übersetzen von C Datentypen
C Datentyp
Pascal Datentyp
Speichergrösse in Bits
Range
char
Char
8-bit
Ein einzelnes Zeichen
signed char
Shortint
8-bit
-128 .. 127
unsigned char
Byte
8-bit
0 .. 255
char*
PChar
32-bit
Zeiger auf ein Chararray
char16_t
WideChar
16-bit
Verwendet für die Darstellung eines Zeichens zwei Byte Speicher (UTF16)
char32_t
WideChar
32-bit
Verwendet für die Darstellung eines Zeichens vier Byte Speicher (UTF32)
short int
SmallInt
16-bit
-32768 .. 32767
unsigned short int
Word
16-bit
0 .. 65535
int
Integer
16-bit oder 32-bit
-32.768 .. 32.767 bzw. -2147483648 .. 2147483647
unsigned int
Cardinal
16-bit oder 32-bit
0 .. 65.535 bzw. 0 .. 4294967295
long int
LongInt
32-bit
-2147483648 .. 2147483647
unsigned long int
LongWord
32-bit
0 .. 4294967295
float
Single
32-bit
1.5E-45 .. 3.4E+38
double
Double
64-bit
5.0E-324 .. 1.7E+308
Übersetzen von C Strukturen
C
Pascal
struct { }
Record End
Strukturierter Datentyp
union { }
Record Case Of
Variant Record
Übersetzen von Sonstigem
C
Pascal
Unit
abs
Abs
System
acos
ArcCos
Math
asin
ArcSin
Math
atan
ArcTan
System
atof
StrToFloat
SysUtils
atoi
StrToInt
SysUtils
atol
StrToInt
SysUtils
atoll
StrToInt64
SysUtils
ceil
Ceil
Math
cos
Cos
System
exp
Exp
System
floor
Floor
Math
pow
Power
Math
round
Round
System
sin
Sin
System
sqrt
Sqrt
System
strcpy
Copy
System
strlen
Length
System
tan
Tan
Math
toupper
UpCase
System
--Olaf 15:29, 9 May 2013 (UTC)
From the Free Pascal wiki, page "Pascal for C users/de", as it stood on 2014-01-12 after a change by Olaf, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.