delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Subject: | RE: C++ name with leading underscore character not Compiling |
Date: | Mon, 16 Apr 2007 12:50:10 +0100 |
Message-ID: | <7231C15EAC2F164CA6DC326D97493C8B01FA0655@exchange35.fed.cclrc.ac.uk> |
In-Reply-To: | <019c01c7801a$6db51f00$2e08a8c0@CAM.ARTIMI.COM> |
References: | <1cbe225f0704160234u24b104a5o9b459178e895a5a8 AT mail DOT gmail DOT com> <018901c7800b$5c4ec450$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <4623592C DOT 2000905 AT sh DOT cvut DOT cz> <019c01c7801a$6db51f00$2e08a8c0 AT CAM DOT ARTIMI DOT COM> |
From: | "Adye, TJ \(Tim\)" <T DOT J DOT Adye AT rl DOT ac DOT uk> |
To: | "Dave Korn" <dave DOT korn AT artimi DOT com>, <cygwin AT cygwin DOT com> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id l3IILAsE012742 |
Hi, Dave Korn wrote on 16 April 2007 12:29: > > Thanks for the correction. I'm referring to the C > standard; I think C++ follows basically the same rules but > don't have a spec handy to refer to. The C++ standard is a little different, but the result in this case is the same:- "17.4.3.1.2/1 Certain sets of names and function signatures are always reserved to the implementation: - Each name that contains a double underscore (__) or begins with an underscore followed by an uppercase letter (2.11) is reserved to the implementation for any use. - Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace. [such names are also reserved in namespace ::std (17.4.3.1)]" This means that a single leading underscore is fine in local scope, as long as it is not followed by an uppercase letter (I am only aware of conflicts with a single upper-case character (eg. _L), but I think the standard would also prevent _Local). So, the case here ("_name" as an argument name) should be fine. (This could have been an issue for my project, since we adopted the convention of "leading underscore for member variables" before C++ had been standardized. Fortunately, we also had adopted the convention of using keeping the first letter of identifiers lower case.) Tim. =========================== cut here ============================ Tim Adye T DOT J DOT Adye AT rl DOT ac DOT uk http://hepunx.rl.ac.uk/~adye BaBar/Atlas Groups, Particle Physics Dept, Rutherford Appleton Lab -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |