Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-05-31 23:24:52


At Friday 2002/05/31 09:49, you wrote:
>----- Original Message -----
>From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>
>
>
> > surely changing the required signature to allow for const is a better
>solution
> > putting const in the signature ALLOWS you to pas both const _and_
>non-const
> > items.
>
>Are you sure? If it was a simple pointer than this would be true, but it's a
>pointer to a pointer. (Or an array of pointers if you prefer.) The following
>does
>not compile in MSVC6 SP5 (and I don't think it should):
>
>void test(const char**) { }
>
>int main(int argc, char** argv)
>{
> test(argv);
> return 0;
>}
>
>error C2664: 'test' : cannot convert parameter 1 from 'char ** ' to 'const
>char ** '
>Conversion loses qualifiers

The following DOES compile on MSVC6 SP5 and MSVC.NET

typedef char* charstar;
void test(const charstar* ) { }

int main(int argc, char** argv)
{
    test(argv);
    return 0;
}

Since the "meaning" is clearly the same.................<shrug>
offhand, I'd call it a compiler bug (the failure to compile, not the
"workaround".

I presume we WOULD like to accept either const or non-const arguments where
applicable.

>Dirk Gerrits
>
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


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