* Porting DOS C code to DEC
@ 1996-09-18 4:00 Bill Haverberg
1996-09-19 4:00 ` Ron Natalie
1996-09-19 4:00 ` Theo Vosse
0 siblings, 2 replies; 4+ messages in thread
From: Bill Haverberg @ 1996-09-18 4:00 UTC (permalink / raw)
A job prospect I have a very strong lead on will consist of porting
DOS C code (non-Windows environment) to a DEC running UNIX. We will be
using Greenleaf to port the interface code, but I'm wondering what
other incompatibilities exist between ANSI C code written for DOS as
opposed to a UNIX environment...does anyone have any experience with
this? I have written extensively using the SCO UNIX V/4.32 release and
have some experience with Turbo C++ / DOS. Can I count on the non I/O
specific libraries to remain consistant across platforms?
Also, this is my first post to comp.sys.dec -- if this is off topic,
please let me know. I would also appreciate a pointer to the newsgroup
faq / relevant web pages, etc so I can be cluefull. A quick scan of
existing articles didn't show anything along that line.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Porting DOS C code to DEC
1996-09-18 4:00 Porting DOS C code to DEC Bill Haverberg
1996-09-19 4:00 ` Ron Natalie
@ 1996-09-19 4:00 ` Theo Vosse
1996-09-19 4:00 ` Szu-Wen Huang
1 sibling, 1 reply; 4+ messages in thread
From: Theo Vosse @ 1996-09-19 4:00 UTC (permalink / raw)
Hi,
In article <51pqb5$gll@darla.visi.com> haverber@visi.com (Bill
Haverberg) writes:
... I'm wondering what other incompatibilities exist between ANSI C
code written for DOS as opposed to a UNIX environment...does anyone
have any experience with this?
Well, I have some experience, and in general everything that relies on
the OS and on machine architecture is a potential incompatibility.
E.g., if you rely on integers being a specific size (e.g. long int
being 32 bits), you might be in for a surprise (on an Alpha they're 64
bits). Idem for pointer sizes. Also, relying on byte ordering in
integers is dangerous...
Binary file I/O should be compatible, but you cannot rely on file
positions when using text file i/o to be the same.
And then there are problems with floating point precision, which may
make a certain algorithm run on one machine, but not on another.
General library calls should also be compatible, but only minimally
so. E.g., if you rely on malloc giving addresses in a certain order
(e.g. from low to high), you might need to change code.
Also, some calls, notably kbhit() en getkey(), are not (directly)
available under Unix.
I have also noted compiler quirks. E.g., one compiler was so anally
retentive on being ANSI, that it had problems compiling calls to
functions with an old style heading (the same holds for functions with
variable arguments). It tended to cast everything to an int (which
ANSI calls integral promotion), so I had some beautiful crashes.
O yeah, something else: DOS file names are case insensitive, but under
UNIX they aren't. So check your #includes. Also, on the
#include-front, depending on what compiler you're used to, things like
#include <sys/types.h> might be organized differently on UNIX
machines. Oh well, porting from dos to unix is much simpler than the
other way around...
Summarizing: if you recompile hllowrld.c, you should not expect
problems...
Theo Vosse
----------
Unit for Experimental Psychology
University of Leiden
The Netherlands
--
Theo Vosse
----------
Unit for Experimental Psychology
University of Leiden
The Netherlands
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Porting DOS C code to DEC
1996-09-18 4:00 Porting DOS C code to DEC Bill Haverberg
@ 1996-09-19 4:00 ` Ron Natalie
1996-09-19 4:00 ` Theo Vosse
1 sibling, 0 replies; 4+ messages in thread
From: Ron Natalie @ 1996-09-19 4:00 UTC (permalink / raw)
There is no difference between ANSI C on these platforms.
The problem is that people rarely adhere to ANSI C in a
meaningful way.
Anyhow things to watch out for:
Pointers are 64 bits on the Alpha and by default on UNIX
they put stuff in the high 32 bits, so be careful with
pointer kludges.
Longs are 64 bits, ints are 32.
There are no "near" and "far" specifiers on the DEC.
C really doesn't include much library definition. This
is handled by other standards. Things that DOS just took
from the UNIX implementations, probably will work, others
may be completely different.
-Ron
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Porting DOS C code to DEC
1996-09-19 4:00 ` Theo Vosse
@ 1996-09-19 4:00 ` Szu-Wen Huang
0 siblings, 0 replies; 4+ messages in thread
From: Szu-Wen Huang @ 1996-09-19 4:00 UTC (permalink / raw)
Theo Vosse (vosse@ruls41.fsw.LeidenUniv.nl) wrote:
[...]
: I have also noted compiler quirks. E.g., one compiler was so anally
: retentive on being ANSI, that it had problems compiling calls to
: functions with an old style heading (the same holds for functions with
: variable arguments). It tended to cast everything to an int (which
: ANSI calls integral promotion), so I had some beautiful crashes.
[...]
A compiler that correctly handles broken code is being "anally
retentive"?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-09-19 4:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-09-18 4:00 Porting DOS C code to DEC Bill Haverberg
1996-09-19 4:00 ` Ron Natalie
1996-09-19 4:00 ` Theo Vosse
1996-09-19 4:00 ` Szu-Wen Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox