Boost logo

Boost :

From: John Nagle (nagle_at_[hidden])
Date: 2004-05-27 20:08:44


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.

    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.

                                John Nagle
                                Team Overbot


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk