4

My university is hosting a Programming Competition, and have decided to support Turbo C (the 16-bit DOS version) as a valid programming environment. I have just read that PC^2, the software that is going to be used to auto-judge the competition, does not support 16-bit programs.

So, is there any alternative to Turbo C that I can use. I need the same header files, and the compiler would need to support all the outdated C standards that Turbo C supports. But the output needs to be 32-bit. Is there any compiler that can satisfy these conditions?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Jibran
  • 920
  • 9
  • 25
  • 1
    Wouldn't *all* contestants have this same compatibility problem? Is Turbo C the *only* programming environment supported? – Greg Hewgill May 10 '10 at 22:45
  • Not all contestants. In addition to Turbo C, we are also supporting gcc, Visual C++ and Java. – Jibran May 10 '10 at 22:46
  • 2
    It seems then that they aren't really supporting Turbo C if their auto-judging software does not support Turbo C. – Greg Hewgill May 10 '10 at 22:57
  • 1
    Why don't you opt to use gcc or anything instead of Turbo C!? – Earlz May 10 '10 at 23:12
  • 1
    Huh? Just because they allow Turbo C doesn't mean that *you* need to use Turbo C or abide by Turbo C-isms. – jamesdlin May 10 '10 at 23:33
  • @jamesdlin: I think you misunderstood my question. What I meant was that I am going to be setting up the lab for the competition. Which means I need to find someway to make Turbo C run with PC^2. Any suggestions? – Jibran May 11 '10 at 00:38
  • 4
    @Asad: you already support several modern compilers - all of which have at least some freely available option. Why not try to convince the powers-that-be to just drop support for Turbo C? – Michael Burr May 11 '10 at 02:19

3 Answers3

5

Portable C programs can be written in many different free compilers and non-free compilers.

For compatibility, you can't go wrong with gcc on Linux machines. If it doesn't work with GCC, you probably have a problem.

In Windows, the Microsoft C compiler is generally considered acceptable, but if you use MS Visual Studio (most schools have an installation) then you need to be very careful to ensure that you are compiling as ANSI-C, rather than later versions of C or even C++. When I used to teach, students used to miss that option, leading to problems with automated tests. Here are some instructions on how to do this with Visual Studio 2005, you can find similar features in later versions.

Uri
  • 88,451
  • 51
  • 221
  • 321
  • I'm willing to go with gcc, since configuring is the easiest with command line options. But does it support all of the header files that came with Turbo C, like conio.h? I just ask because I tried to do that when I first went from Turbo C to gcc and had problems with a number of header files. And conio.h is not part of the ANSI-C standard if I remember correctly? – Jibran May 10 '10 at 22:49
  • @Asad you're using `conio`!? That's a DOS header file. – Earlz May 10 '10 at 23:13
  • 2
    I suggest you go back and learn Standard C and maybe some nice libraries like ncurses and pthreads. "We're not in Real Mode anymore!" – Earlz May 10 '10 at 23:14
  • @Earlz: like I said, not an ANSI-C header file. And I don't think you read the question right. I'm not using conio. The contestants for the programming competition are. I'm trying to find an alternative compiler that can work with PC^2 by compiling to 32-bit. – Jibran May 10 '10 at 23:26
2

I realize this question has an answer, but for anyone searching SO for an alternative to Turbo C for building 16-bit DOS apps, I just want to point out that OpenWatcom has been an excellent alternative. I've been using it under Windows 7 to build 16-bit DOS apps with great success for an embedded target running DOS 6.22.

tomlogic
  • 11,489
  • 3
  • 33
  • 59
0

There is a project to support the Turbo C API on modern compilers (GCC) in Linux.

See: http://www.sandroid.org/TurboC/

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173