Tips for writing *truly* portable C? 
Author Message
 Tips for writing *truly* portable C?

I am preparing a presentation for my department on the topic of "Writing
Truly Portable C" and am gathering pointers, tips, examples (both good
*and* bad), etc. I would be truly grateful if anyone has any goodies (or
pointers to goodies) that they would like to share.  Mostly I'm looking
for simple "do"s and "don't"s.

BTW, what I mean by *truly* portable is: compiler & OS &
machine-architecture independent.

E-mail gratefully accepted, although if the info is of broader interest
perhaps posting to the group is more appropriate.

TIA,
-DWass
--

Software Wizard                                 voice: +49 69 89 03 415
Mannesmann Demag Foerdertechnik                 fax:   +49 69 89 03 646
Offenbach, Germany (on the banks of the river Main)



Mon, 20 Jul 1998 03:00:00 GMT  
 Tips for writing *truly* portable C?

Quote:

>I am preparing a presentation for my department on the topic of "Writing
>Truly Portable C" and am gathering pointers, tips, examples (both good
>*and* bad), etc. I would be truly grateful if anyone has any goodies (or
>pointers to goodies) that they would like to share.  Mostly I'm looking
>for simple "do"s and "don't"s.

>BTW, what I mean by *truly* portable is: compiler & OS &
>machine-architecture independent.

I would be interested in what other people do with regard to writing portable
programs.  I currently do the following:

1. steer clear of non-portable type depandancies. (expecting int or char to
   be a certain size etc..)
2. separate non-portable routines and portable ones.
3. #ifdef system include files as required by the o/s and o/s definitions
4. use the strictest compiler in development stage (& lint) so that ports
   are made easier.
5. use macros as a last resort along with inline #ifdefs to improve code
   readability.
6. step through all code paths in a de{*filter*} to make sure that the data is
   correct (or at least what I think it should be!)

I wonder if I could do more...  Although I have not encountered many problems
with the various UNIX flavors I have had some dificulty going to Windows NT.
Are there some paticular things that have bitten people in the past?  I *try*
to
be as thourough as possible, but I know somewhere a bug lurks deep...

-Pete

This message was ported on Digital UNIX, AIX, Solaris 2.4, NEC-EWS,
       HP-UX, IRIX, Hitachi and VMS. ;^)

-------------------------------------------------------------------------------
Pete Delgado                                      The opinions expressed are
Software Development/Support Engineer             my own and do not reflect
Structural Dynamics Research Corporation          the opinions of SDRC.
2000 Eastman Drive                                
Milford, Ohio 45150

-------------------------------------------------------------------------------



Thu, 23 Jul 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Tips for writing *truly* portable C?

2. Tips on writing *Truly* portable C?

3. Newbie: separate big .cs file into small .cs files

4. How to write portable(ish) C programs?

5. How to write a high portable C program ?

6. writing portable code for structures

7. Principles of Writing Portable C Code

8. Notes on Writing Portable Programs in C: part2.tex

9. Notes on Writing Portable Programs in C: part1.tex

10. Notes on Writing Portable Programs in C: portableC.bib

11. Notes on Writing Portable Programs in C: portableC.sty

12. Notes on Writing Portable Programs in C

 

 
Powered by phpBB® Forum Software