|
Boost Users : |
Subject: Re: [Boost-users] boost::filesystem::path operator/= is broken for char[1] in 1.48 (Nat Linden)
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-04-21 15:18:00
On Sat, Apr 21, 2012 at 7:42 PM, ZNV <mejedi_at_[hidden]> wrote:
> Hi Nat,
>
> >> I believe the current operator =/ behavior is outright dangerous and
>> >> should be fixed.
>>
>> Nope, sorry. If you pass a fixed-length array, a proper C++ library
>> *should* be sensitive to its max. Anything else is unsafe and should
>> be discouraged.
>>
>
> What if I pass fixed-length array without actually knowing that?
> There are many C libraries out there assuming char * and char [] are
> interchangeable.
> These libraries are well documented.
>
Even if it is so, taking &arr[0] of char* or char[...] will always have the
result type char*. So you don't need to make any checks. The only check
needed is that the pointer is not NULL. Or do I oversee smth here?
> [...]
>
Regards,
Ovanes
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net