Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!sun!amdcad!ames!fxgrp!ljz From: ljz@fxgrp.UUCP (Lloyd Zusman) Newsgroups: comp.lang.c Subject: Re: Complex type ? Message-ID: <126@fxgrp.UUCP> Date: Sun, 18-Oct-87 21:41:56 EDT Article-I.D.: fxgrp.126 Posted: Sun Oct 18 21:41:56 1987 Date-Received: Tue, 20-Oct-87 01:12:00 EDT References: <7264@brl-adm.ARPA> <1015@cup.portal.com> Reply-To: ljz@fxgrp.UUCP (Lloyd Zusman) Organization: FX Development Group, Inc., Mountain View, CA Lines: 45 Summary: How 'bout C++? In article <1015@cup.portal.com> Richard_s_Stoneston@cup.portal.com writes: >Well, here's my two cents regarding the future use of type complex in C. > ... >C, on the other hand, can define types very easily through typedef and struct >and enum. > ... >You don't have to require that the complex definition, as an example, need to >be inside the parser. I agree. But this question and many other questions of its ilk that come up here can be answered as follows: You should try C++ Some of us tend to argue ad infinitum (and perhaps even ad nauseum) as to which non-traditional C features can be added to C in some future release. C++ was developed (at least in part) to address some of these issues. For example, in C++, a new data type called "complex" can be defined as, say, a structure consisting of two floats. A series of functions to operate on this 'complex' type can be defined, and these can be mapped into existing C operators. You can, for example, define the operators "+", "-", "*", and "/" to call your complex functions if any of the the operands have been defined as complex. This can be generalized to any new data type. C++ has several other nice features such as inline functions (which can be used to supplant #define macros in many cases), call-by-reference (which in many cases eliminates the need to remember whether to prepend a '&' to a parameter in function call and a '*' when referring to the parameter within the function), variable declaration anywhere in a block before it is referred to, data hiding, and object-oriented constructs. Some of people who want to add features to C might find themselves quite satisfied with what already exists in C++. C++ is very similar to C and you will not lose very many existing C features by using it. The C++ bible is a book called "The C++ Programming Language" by Bjarne Stroustrup and published by Addison-Welsey. Why not check it out? -- Lloyd Zusman ...!ames!fxgrp!ljz