Pascal for C users/de: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Pascal for C users/de
| Old | New | Line | |
|---|---|---|---|
| 1 | + | \ | |
| 2 | + | Zurück zu den [[Additional information/de|Zusätzlichen Informationen]].\ | |
| 3 | + | \ | |
| 4 | + | =Übersetzen von C Operatoren= | |
| 5 | + | ||
| 6 | + | ## Arithmetische Operatoren | |
| 7 | + | ||
| 8 | + | | C | Pascal | Kommentare | | |
| 9 | + | |------|--------|-----------------------------------| | |
| 10 | + | | + | + | Addition | | |
| 11 | + | | - | - | Subtraktion | | |
| 12 | + | | * | * | Multiplikation | | |
| 13 | + | | / | / | Gleitkommadivision | | |
| 14 | + | | % | Mod | Modulo (Division ohne Rest) | | |
| 15 | + | | ++ | Inc | inkrementieren (Hochzählen) | | |
| 16 | + | | -- | Dec | dekrementieren (Herunterzählen) | | |
| 17 | + | ||
| 18 | + | ## Relationale Operatoren | |
| 19 | + | ||
| 20 | + | | C | Pascal | | | |
| 21 | + | |-------|--------|------------------| | |
| 22 | + | | == | = | gleich | | |
| 23 | + | | != | \<\> | ungleich | | |
| 24 | + | | \< | \< | kleiner | | |
| 25 | + | | \<= | \<= | kleiner gleich | | |
| 26 | + | | \> | \> | grösser | | |
| 27 | + | | \>= | \>= | grösser gleich | | |
| 28 | + | ||
| 29 | + | ## Logische Operatoren | |
| 30 | + | ||
| 31 | + | <table> | |
| 32 | + | <thead> | |
| 33 | + | <tr> | |
| 34 | + | <th>C</th> | |
| 35 | + | <th>Pascal</th> | |
| 36 | + | <th>Kommentare</th> | |
| 37 | + | </tr> | |
| 38 | + | </thead> | |
| 39 | + | <tbody> | |
| 40 | + | <tr> | |
| 41 | + | <td> !</td> | |
| 42 | + | <td> Not</td> | |
| 43 | + | <td> Negation (Den Wahrheitswert in sein Gegenteil ändern)</td> | |
| 44 | + | </tr> | |
| 45 | + | <tr> | |
| 46 | + | <td> &&</td> | |
| 47 | + | <td> And</td> | |
| 48 | + | <td> logisches UND mit Kurzschlussauswertung<br /> | |
| 49 | + | In Free Pascal ist dies die Standard-Compilereinstellung</td> | |
| 50 | + | </tr> | |
| 51 | + | <tr> | |
| 52 | + | <td> <nowiki></td> | |
| 53 | + | <td></td> | |
| 54 | + | <td> Or</td> | |
| 55 | + | </tr> | |
| 56 | + | <tr> | |
| 57 | + | <td> &</td> | |
| 58 | + | <td> And</td> | |
| 59 | + | <td> logisches UND mit Komplettauswertung<br /> | |
| 60 | + | In Free Pascal ist dies die Compilerdirektive {$B ON}</td> | |
| 61 | + | </tr> | |
| 62 | + | <tr> | |
| 63 | + | <td> |</td> | |
| 64 | + | <td> Or</td> | |
| 65 | + | <td> logisches ODER mit Komplettauswertung In Free Pascal ist dies die Compilerdirektive {$B ON}</td> | |
| 66 | + | </tr> | |
| 67 | + | <tr> | |
| 68 | + | <td> ^</td> | |
| 69 | + | <td> Xor</td> | |
| 70 | + | <td> exclusives ODER</td> | |
| 71 | + | </tr> | |
| 72 | + | </tbody> | |
| 73 | + | </table> | |
| 74 | + | ||
| 75 | + | ## Bit Operatoren | |
| 76 | + | ||
| 77 | + | | C | Pascal | Kommentare | | |
| 78 | + | |--------|--------|-------------------------------------------| | |
| 79 | + | | ~ | Not | Einerkomplement | | |
| 80 | + | | & | And | bitweises UND | | |
| 81 | + | | \| | Or | bitweises inclusives ODER | | |
| 82 | + | | ^ | Xor | bitweises exclusives ODER | | |
| 83 | + | | \>\> | Shr | bitweises Rechtsschieben mit Vorzeichen | | |
| 84 | + | | \<\< | Shl | bitweises Linksschieben | | |
| 85 | + | ||
| 86 | + | ## Zuweisungs Operatoren | |
| 87 | + | ||
| 88 | + | Hinweis:\ | |
| 89 | + | C-artige Operatoren werden in Free Pascal über die Kommandozeilenoption -Sc ermöglicht. C-artige Operatoren werden in Lazarus über die Projekteinstellungen ermöglicht.\ | |
| 90 | + | {\| 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 \|} | |
| 91 | + | ||
| 92 | + | ## Sonstige Operatoren | |
| 93 | + | ||
| 94 | + | | C | Pascal | | | |
| 95 | + | |------|--------|-------------------| | |
| 96 | + | | & | @ | Adresse von ... | | |
| 97 | + | | * | ^ | Zeiger | | |
| 98 | + | ||
| 99 | + | # Übersetzen von C Anweisungsblöcken | |
| 100 | + | ||
| 101 | + | | C | Pascal | Kommentare | | |
| 102 | + | |-----|---------|-------------------------------------------| | |
| 103 | + | | { | Begin | Anfang eines Anweisungsblocks | | |
| 104 | + | | } | End | Ende / Abschluss eines Anweisungsblocks | | |
| 105 | + | ||
| 106 | + | # Übersetzen von C Kommentarzeichen | |
| 107 | + | ||
| 108 | + | | C | Pascal | Kommentare | | |
| 109 | + | |-------|--------|---------------------------| | |
| 110 | + | | /* | { | Anfang eines Kommentars | | |
| 111 | + | | /* | (* | Anfang eines Kommentars | | |
| 112 | + | | */ | } | Ende eines Kommentars | | |
| 113 | + | | */ | *) | Ende eines Kommentars | | |
| 114 | + | | // | // | Kommentarzeile | | |
| 115 | + | ||
| 116 | + | # Übersetzen von C Schleifentypen | |
| 117 | + | ||
| 118 | + | | C | Pascal | Kommentare | | |
| 119 | + | |----|----|----| | |
| 120 | + | | for( ...; ...; ...++) | For ... To ... Do | Kopfgesteuerte Schleife, die hochgezählt wird | | |
| 121 | + | | for(...; ...; ...--) | For ... Downto ... Do | Kopfgesteuerte Schleife, die heruntergezählt wird | | |
| 122 | + | | while (...) | While ... Do | Kopfgesteuerte Schleife | | |
| 123 | + | | do ... while(...) | Repeat ... Until | Fussgesteuerte Schleife | | |
| 124 | + | | do ... while!(...) | Repeat ... Until ... Not | Fussgesteuerte Schleife mit Negation des Ergebnisses des Ausdrucks | | |
| 125 | + | ||
| 126 | + | # Übersetzen von C Verzweigungen / Bedingungen | |
| 127 | + | ||
| 128 | + | | C | Pascal | Kommentare | | |
| 129 | + | |----|----|----| | |
| 130 | + | | if(...) | If ... Then | If-Bedingung | | |
| 131 | + | | if(...) ... else | If ... Then ... Else | If-Bedingung mit Sonstzweig | | |
| 132 | + | | switch(...) case ...: ... break; | Case ... Of ...: ... End | Case-Bedingung | | |
| 133 | + | | switch(...) case ...: ... break; default ...; | Case ... Of ...: ... Else ... End | Case-Bedingung mit Sonst-Zweig | | |
| 134 | + | ||
| 135 | + | # Übersetzen von C Verzweigungen- / Schleifenabbrüchen | |
| 136 | + | ||
| 137 | + | | C | Pascal | Kommentare | | |
| 138 | + | |----|----|----| | |
| 139 | + | | break | Break | Die break-Anweisung ermöglicht es, vorzeitig eine Schleife (oder ein switch-case-Konstrukt) zu verlassen | | |
| 140 | + | | continue | Continue | Die continue-Anweisung ermöglicht es, den aktuellen Schleifendurchlauf zu beenden | | |
| 141 | + | ||
| 142 | + | # Übersetzen von C Datentypen | |
| 143 | + | ||
| 144 | + | | C Datentyp | Pascal Datentyp | Speichergrösse in Bits | Range | | |
| 145 | + | |----|----|----|----| | |
| 146 | + | | char | Char | 8-bit | Ein einzelnes Zeichen | | |
| 147 | + | | signed char | Shortint | 8-bit | -128 .. 127 | | |
| 148 | + | | unsigned char | Byte | 8-bit | 0 .. 255 | | |
| 149 | + | | char* | PChar | 32-bit | Zeiger auf ein Chararray | | |
| 150 | + | | char16_t | WideChar | 16-bit | Verwendet für die Darstellung eines Zeichens zwei Byte Speicher (UTF16) | | |
| 151 | + | | char32_t | WideChar | 32-bit | Verwendet für die Darstellung eines Zeichens vier Byte Speicher (UTF32) | | |
| 152 | + | | short int | SmallInt | 16-bit | -32768 .. 32767 | | |
| 153 | + | | unsigned short int | Word | 16-bit | 0 .. 65535 | | |
| 154 | + | | int | Integer | 16-bit oder 32-bit | -32.768 .. 32.767 bzw. -2147483648 .. 2147483647 | | |
| 155 | + | | unsigned int | Cardinal | 16-bit oder 32-bit | 0 .. 65.535 bzw. 0 .. 4294967295 | | |
| 156 | + | | long int | LongInt | 32-bit | -2147483648 .. 2147483647 | | |
| 157 | + | | unsigned long int | LongWord | 32-bit | 0 .. 4294967295 | | |
| 158 | + | | float | Single | 32-bit | 1.5E-45 .. 3.4E+38 | | |
| 159 | + | | double | Double | 64-bit | 5.0E-324 .. 1.7E+308 | | |
| 160 | + | ||
| 161 | + | # Übersetzen von C Strukturen | |
| 162 | + | ||
| 163 | + | | C | Pascal | | | |
| 164 | + | |--------------|------------------|---------------------------| | |
| 165 | + | | struct { } | Record End | Strukturierter Datentyp | | |
| 166 | + | | union { } | Record Case Of | Variant Record | | |
| 167 | + | ||
| 168 | + | # Übersetzen von Sonstigem | |
| 169 | + | ||
| 170 | + | | C | Pascal | Unit | | |
| 171 | + | |-----------|--------------|------------| | |
| 172 | + | | abs | Abs | System | | |
| 173 | + | | acos | ArcCos | Math | | |
| 174 | + | | asin | ArcSin | Math | | |
| 175 | + | | atan | ArcTan | System | | |
| 176 | + | | atof | StrToFloat | SysUtils | | |
| 177 | + | | atoi | StrToInt | SysUtils | | |
| 178 | + | | atol | StrToInt | SysUtils | | |
| 179 | + | | atoll | StrToInt64 | SysUtils | | |
| 180 | + | | ceil | Ceil | Math | | |
| 181 | + | | cos | Cos | System | | |
| 182 | + | | exp | Exp | System | | |
| 183 | + | | floor | Floor | Math | | |
| 184 | + | | pow | Power | Math | | |
| 185 | + | | round | Round | System | | |
| 186 | + | | sin | Sin | System | | |
| 187 | + | | sqrt | Sqrt | System | | |
| 188 | + | | strcpy | Copy | System | | |
| 189 | + | | strlen | Length | System | | |
| 190 | + | | tan | Tan | Math | | |
| 191 | + | | toupper | UpCase | System | | |
| 192 | + | ||
| 193 | + | \ | |
| 194 | + | \ | |
| 195 | + | --Olaf 15:29, 9 May 2013 (UTC) | |
| 196 | + | ||
| 197 | + | --- | |
| 198 | + | *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](/wiki-contact).* | |
| 199 | + | Category: Code/de | |
| 200 | + | Category: Deutsch |
