OpenDDS / OpenDDS/OpenDDS

Nested mutable structs are set multiple times to default during deserialize

Open
#3,780 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement intermediate
Dominant language
C++
Stars
1.5k
Forks
516
Avg merge
4d 4h
Merged PRs (30d)
4

Description

Extended the DCPS/XTypes test with the following additional IDL

@topic
@mutable
struct NestedMutableStruct {
  @id(1) ModifiedNameMutableStruct nested_struct;
};

When looking at the generated code the bool operator>>(Serializer& strm, ::NestedMutableStruct& stru) does call set_default(stru) which calls set_default of nested_struct, but also in bool operator>>(Serializer& strm, ::ModifiedNameMutableStruct& stru) there is a call to set_default again, so the nested_struct is set to default 2 times, especially with larger nested structures this looks to be a waste of time

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DCPS/XTypes test and its generated deserialize operators for NestedMutableStruct and ModifiedNameMutableStruct. Trace where set_default is called during deserialization; done means the nested mutable struct is initialized only once while the existing test continues to pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.