I made significant progress in porting Ranish Partition Manager from #Borland #C and #TASM to #Watcom C and #NASM.
All the C files and about half the assembler files are translated. The Watcom built executable is running and a few quick tests revealed no unexpected behaviour. Thoroughly testing has still to be done after the remaining files are translated.
#borland #c #TASM #Watcom #nasm
Implementation defined behaviour in #C: Folgendes packt #Borland C einen char, #Watcom in einen int:
unsigned start_sect:6;
unsigned start_cylH:2;
Daher Struktur unter Borland 16 bytes und unter Watcom 18 🤡
Es muss leider ein char sein. Watcom erlaubt folgendes, um es gerade zu biegen:
unsigned char start_sect:6;
unsigned char start_cylH:2;
Nicht erlaubt laut Standard: "A bit-field shall have a type that is a qualified or unqualified version of one of int, unsigned int, or signed int."
Hier sieht man sehr schön: Unterschiedliche #Compiler, unterschiedliches Laufzeitverhalten des Programmes. Die linke Version ist mit #Borland #C kompiliert, die rechte mit #Watcom C.
Die Daten werden direkt von Platte in eine C Struktur geladen. Dabei sollte man tunlichst auf die Ausrichtung der Strukturelemente achten, sonst kommt Käse wie im rechten Bild raus.
Wen es interessiert: Eric S. Raymond hat eine interessante Abhandlung darĂĽber geschrieben: http://www.catb.org/esr/structure-packing/
@profoundlynerdy There is also a #Vi clone included with the #Watcom C/C++ compilers. I Like that most when working under #DOS / #Windows.