externals questions

Alex Rice alrice at ARCplanning.com
Thu Jun 19 15:41:00 EDT 2003


Yennie, thanks for the info. Makes sense.

Alex

On Thursday, June 19, 2003, at 01:57  PM, Yennie at aol.com wrote:
> This is because you want to explicity allocate memory for the string 
> which MetaCard can use and dispose of. A string constant is allocated 
> locally in your external and could potentially make bad things happen 
> when MetaCard tries to read from that spot in memory (or dispose of 
> the memory).
>
> It may be the case that the memory is dealt with so quickly that the 
> risk is small with such a small return value, but you could 
> potentially get into trouble by way of bad luck, platform differences, 
> and/or the size of the return value.



> Most likely MetaCard checks for NULL, in which case this is ok- but if 
> Metacard is expecting a pointer, it's more "correct" to give it one. 
> If the engine were to try to read from that pointer after you set it 
> to NULL, it could crash your app.
>
> All this is doing is creating an empty string: strings are terminated 
> with a NULL byte, so the 1 byte is just the "end-of-string" marker 
> with no string data before it.
>
Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com







More information about the use-livecode mailing list