Slashdot Mirror


ANSI C89 and POSIX portability?

LordNite asks: "Here is the situation. I am maintaining a piece of source code which is written in K&R C. One of the original goals of this code was to be as portable as possible to as many platforms as possible. The code runs on UNIX and its clones as well as OS/2. The code avoids POSIX functions such as mmap(2) since at the time it was initially written (early 1990s) POSIX was not very wide spread. The code is well written, but in need of some serious fixing. As I go around fixing parts of the code I would also like to modernize it a bit. Since it is now 2004, can I rely on ANSI C89 and POSIX routines without sacrificing the portability of this code? (Yes, I do realize that the purpose of POSIX is code portability...) I am not really interested in the OS/2 port at this time. I am just interested in keeping portability with UNIX clones. To put my question another way: Are there any UNIX-like OSes in common use, which are currently developed and supported by some entity either OSS or proprietary, that do not support POSIX and ANSI C89?"

1 of 85 comments (clear)

  1. Re:Purpose? by fm6 · · Score: 1, Troll
    The answer is elegance.

    If you can't appreciate that answer, that's a strong sign you're not qualified to have an opinion.

    That's pretty patronizing. Or maybe the word is fascist. If I can't understand you, than I must be out of my depth? That's a formula for ignoring anybody that disagrees with you. Since we're discussing elegance of expression, maybe you should just say "Up yours!" and let it go at that!

    Sure elegant code is better than messy code. But rewriting software that has performed reliably for years needs a bigger justification than truisims about elegant code. A programmer's job is to create and maintain reliable software that meets the needs of its users. A sense of software esthetic is justifiable as a means to that ends -- not an end in itself.