home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!microsoft!hexnut!jimad
- From: jimad@microsoft.com (Jim Adcock)
- Subject: Re: portability
- Message-ID: <1992Dec11.223158.8029@microsoft.com>
- Date: 11 Dec 92 22:31:58 GMT
- Organization: Microsoft Corporation
- References: <1992Dec3.051057.14688@siswat.hou.tx.us> <1992Dec04.235922.12074@microsoft.com> <719@ulogic.UUCP>
- Lines: 22
-
- In article <719@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
- |In article <1992Dec04.235922.12074@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
- |>
- |>In my experience C++ code is MUCH more portable than C because much of
- |>the system-dependency hacks tend to be naturally encapsulated in one
- |>class. So one tends to find the system dependency once in one class,
- |>fix it, and then "never" run into that problem again. In "C" code I
- |>tend to find the same system-dependent hack in the code over and over
- |>again at different locations or in slightly different forms.
- |
- |Of course, in well written C the system-dependant stuff should
- |be isolated into sub-routines, which are clearly labeled as
- |system dependant. ;-)
-
- Such is the difference between theory and practice. I'm saying in
- my experience, in practice, the C++ code proves to be easier to port.
- This is because [I believe] that the use of classes leads naturally to
- at least some degree of encapsulation and modularity. C programmers can
- and do write code without either. Its great to talk about portability,
- as long as one realizes that the vast majority of C/C++ code is written
- without any attempt at portability.
-
-