Subject: Re: [boost] [locale] Review part 1: headers
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-04-09 17:34:29
On 09/04/2011 13:38, Artyom wrote:
> Give me a name of modern compiler that supports C++03
> and has sizeof(unsigned)< 4?
On DSPs it is usually 1 byte and 16 bits, but then it could be argued
they have bad compilers.
I wonder if anyone ever tried to run Boost with a TI compiler (they
certainly claim support for C++ is "excellent" on their wiki).
> size_t is used in boost as it is closest way to use something
> in C++03 standard that is similar to uintptr_t.
> That is way C99 and C++03 created uintptr_t.
> In any case as I told I'll change this for better consistency/
size_t is a type big enough to hold the size of any object.
Your data is necessary a single object, since it's a contiguous memory
chunk, therefore size_t is the suitable type to use.
You would only use uintptr_t if you needed to hold the position of any
object or subobject anywhere in memory (which could be necessary if
using a more linked-list-like data structure), which does not appear to
be your case.
In any case, if you want to make your code generic to make it work with
iterators for arbitrary data structures, you would use
>> 3) I don't know of compilers where those are different, mind saying
>> which ones exhibit this?
> As I said before I prefer to relay on native types rather
> then boost's types especially if it is feasible.
> As I told above I'll change this were necessary but
> it is just for "code-beauty".
Erroneous code is hardly beautiful, and relying on integer promotion
(which is an ugly part of C and C++) is very error-prone.
I would have liked a response to question 3) also.
> As I told above I'll change it to size_t but...
> You don't want to run boundary analysis on such chunks of text
> in any case - and if you do it, you are doing something wrong.
And why is that? Because the algorithm doesn't scale?
It should be linear, which is good enough. Documenting its complexity
would be useful otherwise.
> No, see:
Hmm, good point.
You could use a class instead of a typedef to avoid these issues.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk