Skip to content

Handling of structures as function argument #48

@MichaelHuth

Description

@MichaelHuth

Structures can be given as function argument as MRS element or both. Every variant is internally a function argument by reference.

Structures should be only used as MRS element if the structure elements are written before possibly read in the function.

If a structure element is read first then the structure argument should be placed as function argument.

static Structure teststr
	string str
EndStructure

Function test()
	STRUCT teststr s
	
	[s] = AsMRS()
        AsArgument(s)
        AsBoth(s)
End

Function [STRUCT teststr s] AsMRS()

	s.str = "written"
	
	return [s]
End

Function AsArgument(STRUCT teststr &s)

	print s.str
End

Function AsBoth(STRUCT teststr &s)

	print s.str
        s.str = "written"
End

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions