compatibility of types

diamond@tkovoa diamond at tkou02.enet.dec.com
Wed Jul 11 14:18:45 AEST 1990


In article <1990Jul11.002522.24178 at ccu.umanitoba.ca> rpjday at ccu.umanitoba.ca writes:

>  Can someone tell me if ANSI C considers a type of int[3] in
>a prototype compatible with a type of int[5] in the function
>definition?  And are these compatible with a type of int*?
>A reference to the draft would do nicely (this is a subtle
>way of saying that I would RTFM if I knew which section of
>TFM was what I wanted :-)

The answers are yes and yes, because the first two types are adjusted
to be exactly the third type.  Section 3.7.1 states this, and section
3.5.4.3 has a sentence that refers to section 3.7.1.

However, you might want to beware of a subtle difference regarding
some types that you did not ask about.  int(*)[3] and int(*)[5] also
point to integers, but they are not compatible with each other.
It's a bit too subtle for me to figure out if each is compatible
with int* or not.
-- 
Norman Diamond, Nihon DEC     diamond at tkou02.enet.dec.com
This is me speaking.  If you want to hear the company speak, you need DECtalk.



More information about the Comp.std.c mailing list