9

Since in some post on StackOverflow it was recommended to try to support multiple (in this case C/C++) compilers if feasible, since this forces you to code more standard compliant and helps finding bugs.

So I was looking for additional free C/C++ compilers I could add support for to my project (it is written C/C++ (both languages combined)). I found Open Watcom to be an interesting candidate.

So my question is: what are the advantages and disadvantages of Open Watcom C/C++ compiler in comparison to other ones (for example gcc/g++, Visual C++ etc.)?

Nubok
  • 3,502
  • 7
  • 27
  • 47
  • 5
    For anyone who cares. I'm using it right now for commercial development and it's been good to me. Although I have only been using it for c compilation so far. The optimization fine-tuning is there too. I really like how it's 100% free. Also I never took to the gcc world that well. I find more time wasted trying to get my configurations right with gcc. Open Watcom has everything you need out of the box for cross-platform c/c++ or fortran. Less time screwing around with things, more time actually making applications. –  Oct 31 '12 at 03:46

6 Answers6

7

There are probably no particular advantages since if portable code is your aim you would generally try to restrict your code to the standard subset implemented by all compilers. I would say lowest common denominator but that may seem somewhat derogatory.

The advantages of one compiler over another generally lie in either the extensions it provides, the libraries it includes, or the performance of the generated code, if portability is your aim, you are probably interested in neither. It is not the advantages of one compiler over another that should interest you in this case, but rather its adherence to and compliance with the ISO standards.

In its earlier commercial incarnation, Watcom was famously one of the best optimising compilers available; I doubt however whether it has kept pace with processor development since then however (or even the transition for 16 bit to 32 bit x86!).

Its one feature that may be seen as an advantage in some cases is that it supports DOS, OS/2 and Windows, but that is probably only an advantage if legacy systems maintenance is your aim. Efforts to port it to Linux and BSD and processors other than x86 exist but are not complete, while GCC is already there and has been for years.

I would suggest that if you can support GCC and VC++ you probably have sufficient compiler independence (but recommend you compile with high warning level settings (-Wall -Werrorin GCC and \W4 \Wx in VC++). I think that compiler portability is a trivial issue compared with OS portability, and what you really need to consider is cross-platform library support rather than compiler independent code support.

If however playing with compilers is your thing, also consider the Digital Mars compiler. Like Watcom, this also has commercial compiler heritage, having been the Zortech/Symantec C/C++ compiler in a previous life.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • 2
    *"or even the transition for 16 bit to 32 bit x86"* - what do you mean? Watcom support for 32b under DOS was (probably still **is**) one of best. If you did want to do any 32b protected mode for DOS around 1993 (like most of the games from that era, including things like DOOM), you did pick Watcom compiler and DOS extender. .... unfortunately it looks to be quite dead since 2012, and certainly it is not aware of x86-64, or C++11, i.e. your answer is sort of valid, it was just a bit later, that the pace was not kept, at the 32b moment it was quite ahead of the pack. – Ped7g Dec 01 '17 at 03:39
  • @Ped7g There's a fork being maintained at https://github.com/open-watcom/open-watcom-v2 which is actively developed and [explicitly](https://github.com/open-watcom/open-watcom-v2/wiki) gives 64-bit support as their primary focus. – ssokolow Oct 31 '18 at 18:13
  • @Ped7g : I missed your comment nearly a year ago. What I meant was the transition to 32 bit _operating systems_. All that DPMI kludge stuff may work in Win32 but it is hardly elegant. – Clifford Oct 31 '18 at 19:20
  • @ssokolow : A 64 bit Watcom compiler would only be of much interest if it were significantly better in some way than other 64 bit compilers as it was for 16 bit (and 32bit DPMI) compilers. I somehow doubt it, but would have to benchmark it to be sure - I am not sure there is much merit in that any longer for mot applications. – Clifford Oct 31 '18 at 19:25
  • @Clifford I was just correcting the misleading statement that it's been dead since 2012 and has no 64-bit support. (My use for it is limited to retrocomputing cross-compilation, so I think we are in agreement otherwise.) – ssokolow Oct 31 '18 at 21:16
  • @ssokolow fair enough. It is a year old comment in an eight year old post. There may be little benefit in maintaining the currency of this answer. – Clifford Oct 31 '18 at 22:08
6

Some people here use expressions having to do with the Watcom (actually OpenWatcom) compiler being "dated." So what does it mean?

  • It could mean that it doesn't implement the latest C standard. How many "non-dated" compilers do?
  • It could mean that it doesn't provide frameworks as it is primarily an environment for C and ForTran and somewhere far after that comes a C++ implementation which I cannot judge.
  • It could mean that it cannot generate excellent assembly code from garbage C code.
  • It could mean that it doesn't support x64 development.
  • It could mean that the debugger is rudimentary and supports assembly debugging.

Now to what it does do - in addition to supporting 16-bit real and protected mode code:

  • It produces excellent 32-bit protected mode code in the flat memory model everyone uses for the Win32 environment.
  • Its code generating capabilities are excellent and it's right up there at the top with more "non-dated" compilers.
  • It's easy to tune multi-threaded code using its profiler.

How do you "feel" a compiler? I for one don't know how to do that. Is it how the error messages are written? Is it in the messages on the console log?

The world's greatest network operating system - Novell Netware - had Watcom as its development environment. That says a great deal about Watcom. And lest anyone forget: Netware died due to poor marketing management combined with Redmond foul play. It did not die from lack of technological excellence.

I guess what I'm trying to say is that you guys that don't know what you're talking about should perhaps be a little less eager to write answers.

I know I know it's all about getting those coveted points and badges and what have you. And how you get them is irrelevant, right?

Olof Forshell
  • 3,169
  • 22
  • 28
  • 1
    OW's C++ support is abysmal. It was so even before C++11. Other than that it's fine (great in some areas, actually). – Alexey Frunze May 22 '12 at 20:07
  • 1
    @Alex: what they do best is C (though I think ForTran was originally their only product and probably quite good as they survived and weren't without competitors). Why they started messing with C++ is beyond me. Anyway, I use OW for rapid protoyping (before that - 15 years ago - it was QuickC). For x64 I used PellesC for a while but I now have a working gcc+eclipse on Windows 7 which I'm getting used to. – Olof Forshell May 22 '12 at 20:28
5

Something watcom has in favor if your a 'haxxor' is the fact you can define out of the ordinary calling conventions using #pragma aux. Other than that, I see no reason to even attempt to use such a dated compiler unless you had horrible hardware restrictions. Imo, there are only 3 to worry about, GCC, ICC and MSVC

Necrolis
  • 25,836
  • 3
  • 63
  • 101
  • 1
    do you worry about clang today? – Janus Troelsen May 11 '15 at 23:56
  • @JanusTroelsen: I've been following clang closely for a few years now, with LLVM's many strides on Windows, perf increases in compiling, linking and generated code, target architectures & tooling, I'd put it at the front of that list. I prefer it over GCC; though as a Windows dev I primarily use MSVC (though there is now a Clang plugin for VS). – Necrolis May 12 '15 at 19:32
4

The Open Watcom compiler is somewhat outdated and it feels. It is based on what was long time ago a good compiler for making MS DOS games. Currently it is not very standard compliant and its standard library is in immature state.

I would prefer more modern and popular compilers like Intel cc, g++, VC++ or CLang. Not sure about Borland C, haven't tried it long time.

Öö Tiib
  • 10,809
  • 25
  • 44
4

Advantages:

  • it's free
  • it's open source. You can alter it and its runtime libraries any way you like
  • it is crossplatform. You can run it, among other platforms, on Windows and Linux. More, you can build programs with it for different platforms, using a single platform

Disadvantages:

  • it is outdated a bit, but not that much as in the past
dmityugov
  • 4,390
  • 23
  • 18
1

Positive (2)

  1. The code and projects are not bloated like the projects in Microsoft Visual Studio/C++ (Not hundreds of vproj and other files and folders). You can just generate a makefile like in GCC (Which is better to understand than the Visual Projects Makefiles...)
  2. Even the installation takes no big time (on x64 Win 7), in comparisation to 2++ GBytes Visual Project...
  3. Compared to GCC it may seem that it is better to handle
Negative
  1. Clib is missing: strn... functions (strndup, strncmpi etc.), getoptlong
  2. No ARM support (@ 1st July 2015)
  3. As Editor you should really use Notepad++, not the internal Editor
Community
  • 1
  • 1
  • You can use makefiles with Visual C++ all you want, nobody's forcing you to use Visual Studio projects. Also there's kinda no point in comparing a full-fledged multilanguage/platform IDE package with a simple compiler... – Sami Kuhmonen Jul 11 '15 at 10:38
  • 1
    Yes, but try a GUI Project in VIsual Studio without the IDE/Environment... –  Apr 06 '16 at 16:27