commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: FYI: hacking.texinfo update


From: Tom Tromey
Subject: Patch: FYI: hacking.texinfo update
Date: 08 Jan 2004 17:25:33 -0700

I'm checking this in to reflect (what I perceive to be...) consensus
about a particular style point.

Really we might want a new node here with a longer list of things like
this.  I couldn't think of more off the top of my head though.

I'm happy to (slowly) integrate guidelines like this if people point
them out to me.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * doc/hacking.texinfo (Programming Standards): Added note about
        NullPointerException.

Index: doc/hacking.texinfo
===================================================================
RCS file: /cvsroot/classpath/classpath/doc/hacking.texinfo,v
retrieving revision 1.13
diff -u -r1.13 hacking.texinfo
--- doc/hacking.texinfo 29 Nov 2003 09:38:09 -0000 1.13
+++ doc/hacking.texinfo 9 Jan 2004 00:24:19 -0000
@@ -11,7 +11,7 @@
 This file contains important information you will need to know if you
 are going to hack on the GNU Classpath project code.
 
-Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+Copyright (C) 1998,1999,2000,2001,2002,2003, 2004 Free Software Foundation, 
Inc.
 
 @end ifinfo
 
@@ -349,6 +349,44 @@
 For documentation comments, please follow
 @uref{http://java.sun.com/products/jdk/javadoc/writingdoccomments.html,How
 to Write Doc Comments for Javadoc}.
+
+
+Here is a list of some specific rules used when hacking on Classpath.
+
address@hidden FIXME for now there is only one, so just put it here
address@hidden really we need a new node, and a collected list of such rules
address@hidden
+
address@hidden
+Don't catch a @code{NullPointerException} as an alternative to simply
+checking for @code{null}.  It is clearer and usually more efficient
+to simply write an explicit check.
+
+For instance, don't write:
+
address@hidden
+try
+  @{
+    return foo.doit();
+  @}
+catch (NullPointerException _)
+  @{
+    return 7;
+  @}
address@hidden example
+
+If your intent above is to check whether @samp{foo} is @code{null},
+instead write:
+
address@hidden
+if (foo == null)
+  return 7;
+else
+  return foo.doit();
address@hidden example
+
address@hidden itemize
+
 
 @node Programming Goals, API Compatibility, Programming Standards, Top
 @comment node-name, next, previous, up




reply via email to

[Prev in Thread] Current Thread [Next in Thread]