Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!husc6!bbn!rochester!crowl From: crowl@cs.rochester.edu (Lawrence Crowl) Newsgroups: comp.lang.c++ Subject: Re: User defined operators Message-ID: <9541@sol.ARPA> Date: 9 May 88 23:02:43 GMT References: <1206@its63b.ed.ac.uk> <6590049@hplsla.HP.COM> Reply-To: crowl@cs.rochester.edu (Lawrence Crowl) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 22 In article <6590049@hplsla.HP.COM> jima@hplsla.HP.COM (Jim Adcock) writes: >I can't imagine writing C[++] code where operators "always" have to be >separated using whitespace! What a pain! Just try going over your C[++] >programs, separating adjecent operators with whitespace, and you'll realize >why we don't want this "feature" in C++! This is not a problem. Consider three classes of characters, those for identifiers (also keywords and literals), those for grouping (eg parentheses), and those for operators. If you do not mix classes, then you need no spaces between tokens in different groups. This covers most tokens in the stream. The major cases where this does not happen are variable declarations (which currently requires the space) and unary operators adjacent to other operators. If you are not putting a space in your code in the latter case, your code is probably confusing anyway. Consider: a+=b+++*c; versus a+=b++ + *c; The latter provides for user-defined operators with minimal additional typing burden. -- Lawrence Crowl 716-275-9499 University of Rochester crowl@cs.rochester.edu Computer Science Department ...!{allegra,decvax,rutgers}!rochester!crowl Rochester, New York, 14627