type compatibility

Norman Diamond diamond at jit533.swstokyo.dec.com
Wed May 29 12:25:44 AEST 1991


In article <1991May15.205506.24139 at athena.mit.edu> tada at athena.mit.edu (Michael J Zehr) writes:
>suppose you have file1.c:
>  typedef Name char[10];
>and file2.c:
>  typedef Name char[10];
>is this technically correct (i.e. ansi conforming)?  it works correctly
>on my compiler, however my version of lint (lintplus from IPT for VMS)
>complains that something is supposed to take an array argument and it's
>getting a pointer argument.

You should get error messages for that typedef syntax.
However, C has no such thing as an array argument, and your version
of lint doesn't seem to be for the C language.

If you have file1.c:

   typedef char Name[10];
>  void something(Name x);
>  void foo(void) {
>    Name x;
>    something(x);
>  }

and file2.c:

   typedef char Name[10];
>  void something(Name x) {
>  }

then it is impeccable ANSI C.  something is supposed to take a pointer
argument, and gets one.
--
Norman Diamond       diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Permission is granted to feel this signature, but not to look at it.



More information about the Comp.std.c mailing list