From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public From: Vesa Karvonen Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/02 Message-ID: <3432F896.7FD2@HousemarqueREM.fi>#1/1 X-Deja-AN: 277180182 References: <3431A2DB.4273@EasyInternet.net> <5l90wd2sbj.fsf@tequila.systemsz.cs.yale.edu> <60uek7$fon$1@lyra.csx.cam.ac.uk> <60ui2q$33a$1@cdn-news.telecom.com.au> <60ujk7$i58$1@lyra.csx.cam.ac.uk> Organization: Housemarque Games, Inc. Reply-To: Vesa.Karvonen@HousemarqueREM.fi Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Nick Maclaren wrote: > In article <60ui2q$33a$1@cdn-news.telecom.com.au>, > P Murray wrote: > >Nick Maclaren (nmm1@cus.cam.ac.uk) wrote: > > > >: For efficient use of modern architectures, we need languages in which we > >: programmers can express what we want to say in a fashion that can be > >: converted to the sort of instruction stream that executes fast. And > >: the current trends are in exactly the opposite direction. > > > >Any suggestions on what such a language would look like? Hopefully > >it will not look like ASM. Would it be possible to modify C/C++ in > >such a way as to allow this? > > Well, I would favour something using the more successful ideas of > Algol 68 :-) But it would have to include some of the concepts of the > stricter functional languages. > > >And finally, could anyone recommend ways to code in C/C++ that > >avoid these problems and allow the optimiser to produce the > >most efficient code? I assume virtual function calls would > >be out, as well as all forms of aliasing. > > Yes. And, if you can code C without implying aliasing, I take my hat > off to you! The biggest problem with attempting this is that you can > only 'const qualify' at the top level and, for efficient code-generation, > you need to do it at other levels. I believe that the new 'restrict' in > C9X is a sort of recursive 'const', but have not seen a specification. Being an assembly language programmer before learning C, I used to think a bit like you are thinking after seeing the bad code produced by aliasing problems and the like in C. However, after reading "The C++ Programming Language" (second edition) by Bjarne Stroustrup, and seeing that he actually tells you which language constructs generate extra overhead, I have to disagree about leaving language features out simply because they are "bad for the optimizer/processor"; you can always tell the programmers what is bad for the optimizer and the processor. Leaving out useful language constructs, like virtual functions, will only make the language hard to use, by modern standards, and restricts the useability of the language by making certain applications too difficult to implement in the language. With the exception of aliasing problems and problems with restructuring floating point expressions, I see very little room for defining a "faster" C (for single processor systems anyway). The "restrict" qualifier would/will fix the aliasing problem in C. Of course, the problem is that a lot of old code has to be modified, which is usually rather costly. It might not even be necessary to have "restrict", since some of the worse aliasing problems could also be fixed by specifying some kind of syntax for parallel execution of statements/expressions. Such a syntax could come very handy in vector code, for instance. Most optimizing C compilers have optimization switches that can be used to fix both the aliasing and the floating point expression restructuring problems. -- <--> Vesa Karvonen | If I were speaking for my Housemarque Games, Inc. | employer, you would not be http://www.housemarque.com | reading this...