Re: How to allow Warning level about from 'unsigned char *' to 'const char *'



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++


.



Relevant Pages

  • Putty key format.
    ... /* Hacked up ssh-add.c code to convert an OpenSSH key into a format ... static char *comment = NULL; ... int length; ... static unsigned char * buffer = NULL; ...
    (comp.security.ssh)
  • [PATCH][PPC64] lparcfg seq_file updates (pass 3)
    ... -static unsigned char e2a ... +static int lparcfg_data ... * General Public License for more details. ...
    (Linux-Kernel)
  • Re: difference between unsigned char and char in c
    ... The following is about the unsigned char type in C. ... before the standardization by ANSI and ISO, there was just plain char. ... As the language evolved it became useful to have both signed and ...
    (comp.lang.c)
  • Re: Plain Char
    ... >about what the conversion of a char to unsigned char would mean, ... The origin of the mess is historical: the string handling functions ... any time you need a character ...
    (comp.lang.c)
  • Re: What is the difference between signed and unsigned char?
    ... > difference between signed and unsigned char is. ... In this, the value -2, of type int, is converted to unsigned char. ... conversion of out-of-range values to signed types (such ...
    (comp.lang.c)

Loading