我有以下代码:
typedef struct
{
string name;
int length;
}myStruct;
static myStruct getname()
{
static myStruct name;
if (name.length == 0)
{
name.value = "BLABLA";
name.length = name.value.size();
}
return &name;
}
这段代码安全吗??即我可以保证在构造之后myStruct name
,name.length
将等于0