Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: Text editor project in C Date: Mon, 26 Apr 2021 16:57:56 -0700 Organization: None to speak of Lines: 43 Message-ID: <87a6pkbnuj.fsf@nosuchdomain.example.com> References: <877dkohi65.fsf@bsb.me.uk> <1bpmygr6d2.fsf@pfeifferfamily.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="a57ae5a4f402968e927cf79882d3975a"; logging-data="20927"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/P45WYZgqb13zooEE+B2zm" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:zyNhwmNteZ2pEnJgs7J/Pql9F08= sha1:iVGkzCJCF8m7TW00YBp2loTL3ys= Xref: csiph.com comp.lang.c++:79312 comp.lang.c:160386 Joe Pfeiffer writes: > Eli the Bearded <*@eli.users.panix.com> writes: [...] >> 4. Structs are implicitly unions: >> struct plot { >> char p_x; >> char p_y; >> } p_plot[LIM_PLOTS]; >> >> /* ... */ >> >> struct { >> int p_xy; /* used to set/transfer entire plot */ >> }; > > *Lord* that one bit me hard early on. Having all struct members > use a single namespace is a decision I still don't understand (I don't > care how limited the machines running the compiler were). As of the 1975 C manual, a "prefix.identifier" or "prefix->identifier" expression *assumed* that the LHS was of the correct type. For "->", it wasn't even required to be a pointer; it could be a pointer, character, or integer. K&R1 (1978) imposed the requirement for the LHS to be of the correct struct or union type for "." or a pointer to the correct struct or union type for "->". If you ran into that problem, it must have been some very early code and/or a very old compiler. I've used a compiler (VAXC) that knew about the modern "+=" compound assignment operators, but also accepted the older "=+" forms -- and preferred them in ambiguous cases. That was in the late 1990s. That's also a change that was made between 1975 and K&R1 in 1978. Fortunately, though VAXC was available, we mostly used the more modern DECC. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */