From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2afac1a4161c7f35 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Distinguishing type names from other identifiers Date: 1998/01/15 Message-ID: #1/1 X-Deja-AN: 316314378 References: <69iq42$ukn@lotho.delphi.com> <69kf9b$fjr@drn.zippo.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: 884895965 26284 bpr 206.184.139.132 Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-01-15T00:00:00+00:00 List-Id: On 14 Jan 1998 nabbasi@earthlink.net wrote: > In POSIX threads, types are named with a trailing "_t", as in > > pthread_mutex_t > > I found this to be clear and I like it, a little "_t" at the end is not much > extra overhead on the eye. I share your opinion, though I don't find "_Type" too bad either. The most important rule I follow is the "grandfather clause", and that is that if the code I am maintaining/modifying/whatever (how many of times do you get to start at the very beginning?) uses some set of conventions, I strive to be consistent with them, even if I find them personally repugnant (like the plurals for types convention), so that the code has the appearance of being written by one person adhering to a single set of conventions. > my final 2 cents is that a trailing "_t" in Ada would be a good choice > for a type name, I think "_type" is an overkill, and too much extra typing, > but I prefer to see "_type" than nothing at all in the type name. As you can see from all of the postings on this, there are quite a few diverging opinions. It reminds me of the intense arguments over brace placement in C. As long as only one convention is used throughout a project, I don't have too many problems switching over. > Other conventions I use in my C++/Java programming is to use "m_" as the > start of a variable name that is local to a class, this I find helps me > when I am reading code to get a better feeling where things live without > having to go look for them in the code. Doug Lea has a pretty decent Java coding standard available at his home page, which addresses issues like these. -- Brian