|
Boost : |
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2008-07-08 12:25:26
Steven Ross wrote:
>> - Use new and delete rather than *alloc and free.
>> - Can any exceptions occur? If so, is the dynamically allocated memory
>> leaked? Could you use a smart pointer to avoid this?
I was referring to exceptions in general between allocation and
de-allocation, not just during allocation itself.
> Using *alloc, they should return NULL if allocation failed, and that
> situation is handled. With new and delete I'll have to catch memory
> exceptions
See new(nothrow).
>> - Does it work with uint64_t? I see some variables declared as 'long',
>> which often can't store a uint64_t.
>
> There exists the problem of how to identify and deal with negatives. I try
> to avoid forcing any particular return data type
Why not just use Iterator::value_type (or whatever it's called; or some
iterator_traits thing) everywhere?
> They are already divided
> by 512, so an unsigned should fit inside a signed data type without trouble.
Dividing a 64-bit value by 512 does not make it small enough to fit in
a 32-bit long. (Have I misunderstood you?)
Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk