hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin McCabe <cmcc...@alumni.cmu.edu>
Subject Re: Native style guide
Date Wed, 04 Feb 2015 18:45:46 GMT
There are two kinds of native code.

We've been roughly following the Linux Kernel Coding style in the C
code.  Details here:
The main exception is that we use 4 spaces for indentation, not hard tabs.

For C++, there was a thread a while back about adopting the Google C++
Coding Style.  goto would not be acceptable in C++, since you would
use the "resource ownership is acquisition" (RAII) idiom.  There are
various kinds of smart pointer to help with that, although some of the
flavors of smart pointer create incompatibilities with pre-C++11 code.


On Tue, Feb 3, 2015 at 3:19 PM, Chris Nauroth <cnauroth@hortonworks.com> wrote:
> Hi Steve,
> I don't believe we have an official statement of the native code style, so
> that's something that would be beneficial.
> To address your immediate question, yes, it is acceptable to use goto in
> error checking logic to jump to a labeled cleanup routine.  This is an
> established pattern throughout the native codebase.  One example file is
> NativeIO.c.
> Chris Nauroth
> Hortonworks
> http://hortonworks.com/
> On 2/3/15, 1:39 PM, "Steve Loughran" <stevel@hortonworks.com> wrote:
>>Do we have a native code style guide?
>>Specifically, it is OK to use goto as a way of bailing out of things and
>>into some memory release logic as part of some JNI exception generation
>>Don't worry, I'm asking on behalf of someone else
>>ps: what I have been intermittently doing is writing a proper style guide
>>for the Java side of things.

View raw message