Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!uflorida!haven!adm!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.misc Subject: Re: After aliassing -- parallelisation? Message-ID: <5499@lanl.gov> Date: 9 Nov 90 22:18:29 GMT References: <24674:Nov906:50:1890@kramden.acf.nyu.edu> Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 28 From article <24674:Nov906:50:1890@kramden.acf.nyu.edu>, by brnstnd@kramden.acf.nyu.edu (Dan Bernstein): > In article <1990Nov8.183058.25045@maths.nott.ac.uk> anw@maths.nott.ac.uk (Dr A. N. Walker) writes: >> int f() { return i++; } >> { int j = (f(), 2) + (f(), 2); >> printf ("%d\n", i); > [ two f()s may run in parallel, so i's value is undefined ] > > One thing that helps detect this situation is pure functions, which > depend only on their arguments and local variables initialized from > their arguments. [...] Finally an agreement! Pretty much the same thing I said. However, I'm not too sure about your default - shouldn't 'pure' be the default and 'impure' require the extra declaration? :-) I'm only half kidding here - I haven't got an opinion about which should be the default, but it should not be selected by arbitrary means. Do an experiment to find the most common usage. Do another to find the most common expectations of programmers. Then pick you default. > [...] (Clearly subroutines of pure functions must be pure.) And how do you determine _this_ at compile time? :-) Again, only half kidding. This is another thing that the loader would be very good at enforcing. I can _imagine_ arcane schemes involving header files to do this earlier than load-time, but it again requires that the headers and the routines themselves actually match. J. Giles