[PATCH 2/3] Introduce generateStartEndSymbols()

Tulio Magno Quites Machado Filho tuliom@ascii.art.br
Mon Jun 1 23:23:14 GMT 2026


Nick Clifton <nickc@redhat.com> writes:

> Hi Tulio,
>
> I need your C++ expertise:
>
>> +  static inline std::string
>> +  generateStartEndSymbols (const char * fileStart,
>> +			   const char * fileEnd,
>> +			   unsigned int target_start_sym_bias)
>> +  {
>> +    std::ostringstream asm_buf;
>         [...]
>> +    return asm_buf.str();
>> +  }
>>   }
>
> Is this a bug ?  Does asm_buf go out of scope at the end of
> generateStartEndSymbols, thus rendering the return value
> potentially invalid ?

asm_buf.str() copies the contents of the stream to the string object.
So, I believe this is valid code.

-- 
Tulio Magno


More information about the Annobin mailing list