Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- From: "boki" <bokiteam@xxxxxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 19:53:46 +0800
Hi, I don't know that is a problem or not. first pc is running *.c file. I
copy source code to *.cpp of workspace. (both vc6 )
For *.cpp, I add the /J parameter, it still fail ...@@.
Best regards,
Boki.
"Doug Harrison [MVP]" <dsh@xxxxxxxx>
???????:1h4rhi5nmn4bn$.cscnxqpfni8b.dlg@xxxxxxxxxxxxx
> On 11 Apr 2005 18:13:17 -0700, boki wrote:
>
>> Hi All,
>> I change my work PC to another one, but in this IDE, the same
>> source code runnable in another one, here it shows:
>>
>> cannot convert parameter 1 from 'unsigned char *' to 'const char *'
>>
>> How can I allow these Warning to run my program again?
>
> The types unsigned char* and char* are distinct types even if plain char
> is
> implemented as unsigned char, and more to the point, there is no standard
> conversion between these pointer types. If your previous compiler allowed
> it, it was displaying a bug.
>
> Now, if your previous compiler defined plain char to be unsigned, you can
> use the /J compiler option to force VC to treat plain char as unsigned.
> That's the only scenario for which I can recommend /J, and even then I
> view
> it as a temporizing measure. The only thing one should assume about the
> signedness of plain char is that it's either signed or unsigned. :)
> Unfortunately, I don't believe even /J will solve your pointer mismatch
> problem. To fix that, you'll have to change your code, the least intrusive
> way being to cast, e.g. (char*) p, where p is unsigned char*.
>
> --
> Doug Harrison
> Microsoft MVP - Visual C++
.
- Follow-Ups:
- Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- From: Carl Daniel [VC++ MVP]
- Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- References:
- How to allow Warning level about from 'unsigned char *' to 'const char *'
- From: boki
- Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- From: Doug Harrison [MVP]
- How to allow Warning level about from 'unsigned char *' to 'const char *'
- Prev by Date: Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- Next by Date: Java outperforms C++?
- Previous by thread: Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- Next by thread: Re: How to allow Warning level about from 'unsigned char *' to 'const char *'
- Index(es):
Relevant Pages
|
Loading