From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-28 05:08:39
John Nagle wrote:
>Reece Dunn wrote:
>>Different programmers favour the different semantics, so I ask: why not
>>parameterise it, providing a default behaviour.
> As with "do we null-terminate", I think we have to pick a
>behavior and stick to it. I could live with either set of
>semantics, but adding a parameter makes the issue more confusing.
>(And you have to supply conversions.) Most strings are sized a bit too
Ok. I'll stick with the existing "add an extra character for null", since
there seems to be more people wanting that style semantics.
> On a related subject, we should have unconditional null termination.
>"fixed_string" items are always null-terminated. "snprintf",
>"strncat", etc. have hazardous semantics: if you overflow the string,
>it is not null terminated. (This is a bug in my
>current version, incidentally.) We should guarantee null
>termination in all cases. The whole point of this
>class is improved safety, after all.
My implementation ensures this. If it does not, then it is a bug.
Get a FREE connection, FREE modem and one month's FREE line rental, plus a
US or European flight when you sign up for BT Broadband!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk