Re: [protobuf] usage of 'null' as a variable name in protobuf-2.5.0

24 views
Skip to first unread message

Feng Xiao

unread,
May 20, 2013, 12:55:32 PM5/20/13
to daniel...@gmail.com, Protocol Buffers



On Thu, May 16, 2013 at 10:58 PM, <daniel...@gmail.com> wrote:
Version 2.5.0 has the following line in a couple of places in repeated_field.h:

MessageLite* null = NULL;


My gnu-based compiler doesn't like this as it thinks 'null' is a constant.

If I rename 'null' as 'narl' then it's OK.

Is 'null' a valid variable name?
I believe it is. You are probably using some library which defines null as a macro.
 


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Henner Zeller

unread,
May 20, 2013, 3:52:53 PM5/20/13
to Feng Xiao, daniel...@gmail.com, Protocol Buffers
On 20 May 2013 09:55, Feng Xiao <xiao...@google.com> wrote:



On Thu, May 16, 2013 at 10:58 PM, <daniel...@gmail.com> wrote:
Version 2.5.0 has the following line in a couple of places in repeated_field.h:

MessageLite* null = NULL;


My gnu-based compiler doesn't like this as it thinks 'null' is a constant.

If I rename 'null' as 'narl' then it's OK.

Is 'null' a valid variable name?
I believe it is. You are probably using some library which defines null as a macro.

Still, it might not be a good idea to use such a name. I could imagine translating this proto buffer into other languages might create trouble.

-h
Reply all
Reply to author
Forward
0 new messages