Portability of passing/operating on structures...

Chip Salzenberg chip at ateng.ateng.com
Tue Oct 25 07:22:08 AEST 1988


According to g-rh at XAIT.Xerox.COM (Richard Harter):
>       Yes, I pander to broken compilers.  I have to.

If I must work with a specific broken compiler, then I do the same: pay for
play has its own rules.  I was, of course, referring to situations where
there *is* a choice, such as when writing free software, in which case I
don't worry about it.

>	And the truth of the matter is that there is no penalty for
>writing portable code [...]

But there *is* a penalty in pandering to broken compilers.  If, for example,
a compiler breaks on:

	foo(s) short s;
	{
	    short *sp = &s;
	    int i = *sp;

	    printf("%d\n", i);
	}

Then you have to invest time and effort into avoiding a language construct
-- taking the address of a function parameter -- that should have worked.
(I know that some compilers do, in fact, break this contruct.) I'm sure all
will agree that spent time and effort are just as much a "penalty" as
execution time.
-- 
Chip Salzenberg             <chip at ateng.com> or <uunet!ateng!chip>
A T Engineering             Me?  Speak for my company?  Surely you jest!
	   Beware of programmers carrying screwdrivers.



More information about the Comp.lang.c mailing list