comparing structures, complex data type

9212osd at houxa.UUCP 9212osd at houxa.UUCP
Tue Sep 27 03:51:00 AEST 1983


A discussion on whether the C compiler should
support the comparison of structures has been going on
in this group recently.  Some said that there were not many
applications where this would pay off.  Let me give you an
example.

Consider the absence of the complex data type in C.
Most programmers will do this:

	typedef struct { double re, im } complex;

To compare two complex numbers defined as above is not
straightforward and comparison of structures in general,
would help.

But, to add, multiply, divide, etc., etc., complex numbers in C
is a pain anyway since you have to define macros (or functions)
to do the operations.*  The resulting code is hard to read,
especially to the scientist or engineer who is used to the
FORTRAN or PL/I language.  Consequently, the C Programming Language
is hard to sell to the hard-core scientist or engineer who just
wants to be reassured that a*b is a*b, no matter whether a or b
are complex or not. 

Do I hear any echos?
_
* Sure you could also write yappfcn. The one I'm aware of isn't very
clean, anyway.
_
-- 
Orlando Sotomayor-Diaz /AT&T Bell Laboratories, Crawfords Corner Road
Room HO-3M-325	201-949-1532	Holmdel, New Jersey, 07733
Path: {{{ucbvax,decvax}!}{ihnp4,harpo}!}houxa!9212osd



More information about the Comp.lang.c mailing list