Problems with IBM RS6000 C compiler

Henry Spencer henry at zoo.toronto.edu
Sun Aug 5 07:38:49 AEST 1990


In article <476 at mtndew.UUCP> friedl at mtndew.UUCP (Stephen J. Friedl) writes:
>For instance, <sys/stat.h> defines the prototype for stat:
>
>	extern int stat(char *filename, struct stat *stptr);
>
>Shouldn't the "filename" argument be const qualified?  I
>use const all over my code, and the compiler throws up ...

The filename *probably* ought to be const qualified, but the current
standards are mostly written in old C and don't specify this.  This
is a difficult problem, although `#define const /* */' can be helpful.

>	extern void	foo( void *** );
>	any_type	**array;
>		foo(&array);
>
>	9 |         arrsize(&array);
>	   .................a.......
>a - 1506-193: (S) Function call arg cannot be assigned to corresponding param.
>I just don't get it; the ANSI compiler on the 3B2 doen't complain about this.

It should.  There is a special-case exemption for implicit conversions to
and from `void *'.  Not `void ***'.  Just `void *'.  Nothing else.  All
other pointer types require explicit conversion.
-- 
The 486 is to a modern CPU as a Jules  | Henry Spencer at U of Toronto Zoology
Verne reprint is to a modern SF novel. |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list