Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Toy code for currency handling Date: Wed, 06 Dec 2017 11:22:22 -0800 Organization: None to speak of Lines: 22 Message-ID: References: <3HQVB.175748$E01.77780@fx09.am4> <1a6ac0d7-4557-4b8e-9127-032e85c4410e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="5fcb52a454ca5cdef47d9e58fe656d33"; logging-data="7719"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gD2oT07qukpmouXdZJKVs" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:7R+MQ0IZ3INsExMZxidB5chFdqg= sha1:Yoo878lSwdwJsENB292Zwao+eb4= Xref: csiph.com comp.lang.c:123940 scott@slp53.sl.home (Scott Lurndal) writes: [...] > In C++ the 'struct' keyword is optional in the above usecase and > thus 'tree tree' wouldn't be syntactically correct in C++. Actually it would. This: struct tree { int n; }; tree tree; is legal in C++ (or at least "g++ -std=c++11 -pedantic" doesn't complain about it). But after the second declaration, the type name "tree" is hidden by the object name. Similar C code using typedef is rejected. Perhaps the scoping rules are subtly different. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"