Suspicious pointer conversion warning in Turbo C 2.0

Suspicious pointer conversion warning in Turbo C 2.0

Post by Karl Heu » Sat, 28 Jul 1990 09:31:42



Quote:>> void AddLNode(void ** Hptr, void * Nptr);
>> Tlist *Head, *Walker;
>> AddLNode(&Head,Walker);    /* This statement generates a warning */

>The warnings you are getting are from the first parameter.  When I cast
>it to AddLNode((void **)&Head, Walker); I don't get any warnings.

It should be noted that, although it silences the warnings, the cast makes the
code incorrect.  It will fail on (existing) implementations where `Tlist *'
and `void *' do not have the same internal format.


Followups to comp.lang.c only.

 
 
 

Suspicious pointer conversion warning in Turbo C 2.0

Post by Karl Heu » Sat, 28 Jul 1990 09:35:29


Quote:>> void AddLNode(void ** Hptr, void * Nptr);
>> Tlist *Head, *Walker;
>> AddLNode(&Head,Walker);    /* This statement generates a warning */

>The warnings you are getting are from the first parameter.  When I cast
>it to AddLNode((void **)&Head, Walker); I don't get any warnings.

It should be noted that, although you can silence the warnings, the code
is incorrect with or without the cast.  It works on vaxlike architectures,
but will probably fail on (existing, not hypothetical) implementations where
`Tlist *' and `void *' do not have the same internal format.


Followups to comp.lang.c only.

 
 
 

1. Suspicious pointer conversion

cApiStr is a char *
Thus &cApiStr is a pointer to a pointer which is one leel of re-direction too
many.
This is what you want.
    HLLC(nApiFunc, cApiStr, &nApiLen, &nApiRetc);
                   /\ no &, its already a pointer.
The AnArChIsT - Anarchy! NOT Chaos! aka Alex Russell

2. Integrating SMS with HP Openview

3. Conversion warnings

4. DOMDocument to ADODB.Recordset

5. Compatibility between Turbo C 2.0 and Turbo C++ for Windows 3.1

6. FP99

7. Blitting warning under GRX 2.0 using GrBitBlt

8. GCC warning - incompatible pointer type

9. pointer to functions - Warning error

10. void pointer arithmetic causes warning message

11. QuickC warning on pointer assignment

12. Help: warning: passing arg ... of ... discards qualifiers from pointer target type