why not!?!
>_<
why not!?!
>_<
here is the original context of the issue:
Code:foo(const unsigned char*& data) { // do something } void bar(unsigned char* data) { foo(data); }
this also demonstrates the problem:
oddly though, this does not generate errors:Code:unsigned char* f; const unsigned char*& crf = f; //seemingly spurious error msg: "Conversion loses qualifiers"
am i overlooking something here or is this a compiler error?Code:void foo(const unsigned char*& data) { // do something } void bar(unsigned char* data) { const unsigned char* temp = data; foo(temp); }
Code would be nice. [Edit: Thank you]
If I'm not mistaken, the reference here is non-const. You can only bind arguments to non-const references if they are the same type (and not temporary), but unsigned char* and const unsigned char* are not the same type.Code:void foo(const unsigned char*& ) { } int main() { unsigned char* p; foo(p); }
Compare with
Code:void foo(const unsigned char* const&);
Last edited by anon; 10-06-2009 at 09:39 AM.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.