{"action":"closed","issue":{"url":"https://api.github.com/repos/lcm-proj/lcm/issues/32","labels_url":"https://api.github.com/repos/lcm-proj/lcm/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/lcm-proj/lcm/issues/32/comments","events_url":"https://api.github.com/repos/lcm-proj/lcm/issues/32/events","html_url":"https://github.com/lcm-proj/lcm/issues/32","id":101047709,"number":32,"title":"are empty vectors required required for 2D arrays in C++?","user":{"login":"mauricefallon","id":6404227,"avatar_url":"https://avatars.githubusercontent.com/u/6404227?v=3","gravatar_id":"","url":"https://api.github.com/users/mauricefallon","html_url":"https://github.com/mauricefallon","followers_url":"https://api.github.com/users/mauricefallon/followers","following_url":"https://api.github.com/users/mauricefallon/following{/other_user}","gists_url":"https://api.github.com/users/mauricefallon/gists{/gist_id}","starred_url":"https://api.github.com/users/mauricefallon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauricefallon/subscriptions","organizations_url":"https://api.github.com/users/mauricefallon/orgs","repos_url":"https://api.github.com/users/mauricefallon/repos","events_url":"https://api.github.com/users/mauricefallon/events{/privacy}","received_events_url":"https://api.github.com/users/mauricefallon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-14T16:30:08Z","updated_at":"2015-09-02T08:43:06Z","closed_at":"2015-09-02T08:43:06Z","body":"Consider this message type:\r\nstruct pointcloud_t\r\n{\r\n  int32_t n_points;\r\n  float points [n_points][3];\r\n\r\n  int32_t n_channels;\r\n  float channels [n_points][n_channels];\r\n}\r\n\r\nAnd this c++ publishing code ... where no channel data is being filled in:\r\npointcloud_t out;\r\nfor (size_t i = 0; i < 100; i++) {\r\n  std::vector<float> point = { 0.0, 1.0, 2.0};\r\n  out.points.push_back(point);\r\n  std::vector<float> channels = {};\r\n  out.channels.push_back(channels);\r\n}\r\nout.n_points = out.points.size();\r\nout.n_channels = 0;\r\nlcm_pub_->publish(\"CHANNEL\",&out);\r\n\r\nWithout these two lines calling publish() causes a seg fault\r\n  std::vector<float> channels = {};\r\n  out.channels.push_back(channels);\r\n\r\nIs this intended? or the publish function anyway?"}}