[mercury-users] string_stream impl, re: redirecting output to streams

Peter Hawkins hawkinsp at cs.stanford.edu
Fri Feb 17 04:59:01 AEDT 2006


Hi...
On Feb 16, 2006, at 2:34 AM, Michael Day wrote:

>
>> On this note I feel there is a big need for binary string support
>> (strings with null bytes). It's difficult to do meaningful binary  
>> string
>> buffer operations with the current (null-terminated) string  
>> library. I
>> hacked up a quick and dirty binary string library which uses strings
>> with an explicit length, but I think the right thing to do is to  
>> change
>> the standard string library to operate this way. Any objections, in
>> principle?
>
> Personally I like the ease of interoperability with C-style  
> strings, that
> is a very strong point in favour when interfacing with foreign  
> code, and
> we have lots of code that takes advantage of that.

Perhaps we can have the best of both worlds by using a null  
terminator as well as an explicit length. That way foreign code can  
continue to treat the character data of a string as a C string.  
Strings with embedded nulls will break when used in such a way, of  
course, but that's what happens at the moment anyway.

Cheers,
Peter
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list