Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!jarthur!petunia!kestrel.edu!gyro From: gyro@kestrel.edu (Scott Layson Burson) Newsgroups: comp.std.c++ Subject: Re: Assignment operators return lvalues / classes and types Keywords: assignment, lvalue, class, type Message-ID: <1991Apr24.184018.23427@kestrel.edu> Date: 24 Apr 91 18:40:18 GMT References: <950@edg1.UUCP> Organization: Kestrel Institute, Palo Alto, CA Lines: 36 In article <950@edg1.UUCP> jsa@edg1.UUCP (J. Stephen Adamczyk) writes: >The ARM (5.1.7) says that the value of an assignment operator is >an lvalue. That's different than ANSI C (3.3.16). There must >be a reason for the difference; can anyone enlighten me? I surmise, without really knowing, that people want to write things like `(a = b).foo', for which it is required that the assignment return an lvalue. >Also (different topic) -- is the example right at the end of >12.4 of the ARM, i.e., > > int *p; > p->int::~int(); > >really thought to be legal? Isn't the name to the left of "::" >required to be a class-name? Hm! You seem to have found an inconsistency in the ARM. The definitions on p. 24, and especially the comment near the top of p. 25: We refer to classes (including structures and unions) as *user-defined* types and other types as *built-in* types [emphasis in original]. seem to say quite clearly that `int' is not a class name, and the description of a qualified name on p. 48 says pretty clearly that a class name is required. Seems like the latter needs to be fixed. The purpose of allowing code such as this example, of course, is to allow templates to be expanded with both built-in and user-defined types. -- Scott Gyro@Reasoning.COM