Path: utzoo!utgpu!attcan!uunet!husc6!cmcl2!rutgers!apple!voder!pyramid!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: Passing types to a subroutine Message-ID: <996@goofy.megatest.UUCP> Date: 10 Nov 88 05:25:00 GMT References: <14457@mimsy.UUCP> Organization: Megatest Corporation, San Jose, Ca Lines: 20 From article <14457@mimsy.UUCP>, by sjr@mimsy.UUCP (Stephen J. Roznowski): > I'm in the process of developing a piece of code that needs > to be portable across several different machines. ... [ How to switch between using floats and doubles? ] If I understand the question, you can do it as follows. Declare a typedef for the type "real". Use "real" everywhere instead of "float" or "double". #ifdef FLOATS typedef float real; #else typedef double real; #endif You should be sure you are familiar with the way floats are cast to doubles on procedure calls, etc.. (See K&R) If your machine uses IEEE floating point format, the cast operation takes a nontrivial amount of time.