Re: Pro*C and Pointers are not assignment compatiable

From: george <wgweis_at_ucdavis.edu>
Date: 1997/02/18
Message-ID: <5ed8gm$ai8$1_at_mark.ucdavis.edu>#1/1


Scott:

I have seen a similar warning from our C compiler when trying to copy a string pointed to by a 'char*' into a varchar. The problem with our compiler
is that the .arr element of the varchar structure is an 'unsigned char*' and the default for a 'char *' is unsigned. If you specifically cast the second argument to 'unsigned char*', the warnings should go away. I.e:
strcpy(myvarchar.arr, (unsigned char*) someptr);

Hope this helps,

George

"Scott T. Johnson" <sjohnson_at_ibm.net> wrote:

>I am working on a Pro*C program and cannot get rid of the following
>warning. My Pro*C call is included as well as the code. I am running
>on an HP using HP-UX 9.04 and the generic C compiler that comes with the
>OS.
 

>Thanks,
>Scott

> /orax2/oracle/7.2/bin/proc sqlcheck=full iname=p.pc
 

>Pro*C/C++: Release 2.1.3.0.0 - Production on Wed Feb 12 07:03:51 1997
 

>Copyright (c) Oracle Corporation 1979, 1994. All rights reserved.
 

>System default option values taken from: /orax2/oracle/7.2/proc/pmscfg.h
 

> cc -I. -O -Aa -D_HPUX_SOURCE +ESsfc +ESlit
>-I/orax2/oracle/7.2/sqllib/pc
>cc: "p.c", line 209: warning 604: Pointers are not
>assignment-compatible.
>cc: "p.c", line 209: warning 563: Argument #1 is not the correct type.
>cc: "p.c", line 210: warning 604: Pointers are not
>assignment-compatible.
>cc: "p.c", line 210: warning 563: Argument #1 is not the correct type.
>cc: "p.c", line 213: warning 604: Pointers are not
>assignment-compatible.
>cc: "p.c", line 213: warning 563: Argument #1 is not the correct type.
>cc: "p.c", line 214: warning 604: Pointers are not
>assignment-compatible.
>cc: "p.c", line 214: warning 563: Argument #1 is not the correct type.
>cc: "p.c", line 215: warning 604: Pointers are not
>assignment-compatible.

>Sample Code:

>void main(int argc, char **argv)
>{
 

>EXEC ORACLE OPTION (ORACA=YES);
> VARCHAR sqlstmt[150];
> VARCHAR v_prodcode[10];
> VARCHAR prodcode[10];
 

>/* The ORACA=YES option must be specified to enable use of
> * the ORACA.
> */
 

>oracle_login("/");
 

>strcpy(sqlstmt.arr, "SELECT PROD_CODE FROM PP_PRODUCT WHERE PROD_CODE");
>strcat(sqlstmt.arr, " = :v1");
Received on Tue Feb 18 1997 - 00:00:00 CET

Original text of this message