There are two kinds of native code.

We've been roughly following the Linux Kernel Coding style in the C
code.  Details here:
https://www.kernel.org/doc/Documentation/CodingStyle
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.

best,
Colin

On Tue, Feb 3, 2015 at 3:19 PM, Chris Nauroth <cnaur...@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" <ste...@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
>>routine?
>>
>>Don't worry, I'm asking on behalf of someone else
>>
>>
>>-Steve
>>
>>ps: what I have been intermittently doing is writing a proper style guide
>>for the Java side of things.
>>
>>https://github.com/steveloughran/formality/blob/master/styleguide/stylegui
>>de.md
>

Reply via email to