RE: [boost] Re: static sized strings

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 big, anyway.
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. Regards, Reece _________________________________________________________________ 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! http://www.msn.co.uk/specials/btbroadband
participants (1)
-
Reece Dunn