There is no explicit test for this, but the official c++ implementation
emits code that successfully compiles for this message:

message TestRepeatedRecursiveMessage {
  repeated TestRepeatedRecursiveMessage a = 1;
  optional int32 b = 2;
}

On Fri, Apr 1, 2011 at 7:52 AM, zad <emanuele.plac...@gmail.com> wrote:

> Ok I'll do, I  asked to be sure if a recursive definition was
> "syntactically" correct.
> Can you please check if there is a test case or an example?
>
> On Apr 1, 4:44 pm, Jason Hsueh <jas...@google.com> wrote:
> > You appear to be using a third party implementation for pure C. You'll
> have
> > to check with the author of the implementation.
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Apr 1, 2011 at 7:25 AM, zad <emanuele.plac...@gmail.com> wrote:
> > >  message resource_info {
> > >        optional string device_name=18;
> > >        optional Res_type res_type=19 [default=RAW];
> > >        repeated resource_info resources=2;
> > > }
> >
> > > the above message generates the following .h
> >
> > > /*! \file deviceManager_hint.h
> > >  *  \brief message hints
> > >  */
> >
> > > /*------------------------------------------------------------------
> > >  * Generated 2011-04-01 15:14:14 +0100
> > >  *           by protoc99 version 0.17
> > >  * DO NOT EDIT! See "man protoc99" for details.
> > >  *
> > >  *------------------------------------------------------------------
> > >  */
> >
> > > #ifndef _CIDL_DEVICEMANAGER_HINT_H
> > > #define _CIDL_DEVICEMANAGER_HINT_H
> >
> > > #include <protoc99_hint.h>
> >
> > > enum {
> > >  cidl_resource_info_size_hint = 0
> > >    + PROTOC99_TAG_TYPE_SIZE(1) + PROTOC99_MAX_VAR32_SIZE +
> > > PROTOC99_DEFAULT_STRING_LENGTH /* resource_info::device_name */
> > >    + PROTOC99_TAG_TYPE_SIZE(2) + PROTOC99_MAX_VAR32_SIZE /*
> > > resource_info::res_type */
> > >    + (PROTOC99_TAG_TYPE_SIZE(3) + PROTOC99_MAX_VAR32_SIZE +
> > > cidl_resource_info_size_hint) * PROTOC99_DEFAULT_ARRAY_COUNT /*
> > > resource_info::resu
> > >  cidl_device_list_size_hint = 0
> > >    + PROTOC99_TAG_TYPE_SIZE(1) + PROTOC99_MAX_VAR32_SIZE /*
> > > device_list::found_dev */
> > >    + (PROTOC99_TAG_TYPE_SIZE(2) + PROTOC99_MAX_VAR32_SIZE +
> > > cidl_resource_info_size_hint) * PROTOC99_DEFAULT_ARRAY_COUNT /*
> > > device_list::resour
> > >  cidl_get_device_info_size_hint = 0
> > >    + PROTOC99_TAG_TYPE_SIZE(1) + PROTOC99_MAX_BOOL_SIZE /*
> > > get_device_info::result */,
> > >  cidl_device_info_registered_size_hint = 0,
> > >  cidl_device_info_unregistered_size_hint = 0,
> >
> > > };
> >
> > > #endif /* _CIDL_DEVICEMANAGER_HINT_H */
> >
> > > And during gcc build I got an "/cidl_deviceManager_hint.h:25: error:
> > > 'cidl_resource_info_size_hint' undeclared here (not in a function)"
> > > error from the compiler.
> >
> > > On Apr 1, 2:05 am, Jason Hsueh <jas...@google.com> wrote:
> > > > Recursive definitions should work, though I'm not sure we have a test
> > > case
> > > > to verify use in repeated fields. I know there is one for optional
> > > messages.
> > > > What result did you get?
> >
> > > > On Tue, Mar 29, 2011 at 5:58 AM, zad <emanuele.plac...@gmail.com>
> wrote:
> > > > > Is it possible to have in a message declaration an array of the
> > > > > declaring message?
> > > > > Let me explain better:
> > > > > I'm trying to achieve the following:
> >
> > > > > message resource_info {
> > > > >        optional string device_name=18;
> > > > >        optional Res_type res_type=19 [default=RAW];
> > > > >        repeated resource_info resources=2;
> > > > > }
> >
> > > > > I tried also with this:
> > > > > message resource_info {
> > > > >        optional string device_name=18;
> > > > >        optional Res_type res_type=19 [default=RAW];
> > > > >        extensions 2 to 3;
> > > > > }
> > > > > extend resource_info{
> > > > >        repeated resource_info resources=2;
> > > > > }
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Protocol Buffers" group.
> > > > > To post to this group, send email to protobuf@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > protobuf+unsubscr...@googlegroups.com.
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/protobuf?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Protocol Buffers" group.
> > > To post to this group, send email to protobuf@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > protobuf+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/protobuf?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to