Re: [protobuf] Can protobuf work with C++ templates?

2015-01-21 Thread Stephen Tu
This is not really a protobuf question, moreso a C++ question. But anyways, the typical way to do this is: template struct MatrixTraits { }; template <> struct MatrixTraits { typedef DoubleMatrix type; }; template <> struct MatrixTraits{ typedef FloatMatrix type; }; template class Matrix {

Re: [protobuf] Message was missing required fields

2015-03-10 Thread Stephen Tu
On Tue, Mar 10, 2015 at 5:09 PM, Patrick Linehan wrote: > > A simple workaround is to modify the compiler output to make both > memoizedIsInitialized and isInitalized into ints. This avoids any need for > casting or sign extension. > Wait what? If this is really the problem, why not make these tw

Re: [protobuf] ProtoBuff with Scala

2013-01-15 Thread Stephen Tu
You should just be able to use the Java bindings. On Tue, Jan 15, 2013 at 8:07 AM, Florian Johannßen < fjohanns...@googlemail.com> wrote: > Hi everybody, > > is it possible to use ProtoBuff in Scala-projects? > Do you have made any experience with it? > > Kind regards > > Florian > > -- > You rec

Re: [protobuf] Re: EBNF grammar for .proto files

2013-05-31 Thread Stephen Tu
The [\w_]* means to match any sequence of "word" characters or an underscroll (which I believe is redundant). Please see: http://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Regular_expression On Fri, May 31, 2013 at 10:17 AM, Ruffian Eo wrote: > I am not very good with reading regular expres

Re: [protobuf] Issue 542 in protobuf: The memory leak problem

2013-08-08 Thread Stephen Tu
If you link in tcmalloc to your app, it should just work w/o having to change any code. See http://goog-perftools.sourceforge.net/doc/tcmalloc.html On Thu, Aug 8, 2013 at 7:12 AM, wrote: > Status: New > Owner: liuj...@google.com > Labels: Type-Defect Priority-Medium > > New issue 542 by leening

Re: [protobuf] Re: Issue 542 in protobuf: The memory leak problem

2013-08-08 Thread Stephen Tu
Yes, observe: $ cat t.cc #include using namespace std; struct foo { char b[4096]; }; int main(void) { foo *f = new foo; return 0; } $ g++ -o t t.cc -ltcmalloc $ gdb --args ./t GNU gdb (GDB) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later

Re: [protobuf] Re: Issue 599 in protobuf: Fails to compile for Intel Phi

2014-01-22 Thread Stephen Tu
MemoryBarrier() should probably have a compiler fence in it. For gcc, this looks like: asm volatile("" ::: "memory") not sure about other compilers. On Tue, Jan 21, 2014 at 2:57 PM, Peter Burka wrote: > If accepted, please attribute the patch to my work address: peter dot > burka at twosigma

Re: [protobuf] Re: Issue 599 in protobuf: Fails to compile for Intel Phi

2014-01-23 Thread Stephen Tu
I think you might actually want two memory barriers, something like MemoryBarrier(); *ptr = value; MemoryBarrier(); your current solution prevents compiler reordering the store with statements after, but what about statements before? On Thu, Jan 23, 2014 at 11:20 AM, wrote: > > Comment #1 on

Re: [protobuf] Re: Issue 599 in protobuf: Fails to compile for Intel Phi

2014-01-23 Thread Stephen Tu
Yes my bad, it is not called SequentiallyConsistentStore but AcquireStore :) On Thu, Jan 23, 2014 at 11:57 AM, Peter Burka wrote: > Hi Stephen, > > Honestly I didn't think about it too deeply. I simply copied the same > pattern that the x86-64 SSE2 code is using. If a second barrier is > requir