Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lupine!rfg From: rfg@NCD.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: parameter[][] Message-ID: <1068@lupine.NCD.COM> Date: 4 Aug 90 00:41:23 GMT References: <1545@m1.cs.man.ac.uk> Reply-To: rfg@ncd.com Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 35 In article <1545@m1.cs.man.ac.uk> jk@cs.man.ac.uk (John Kewley ICL) writes: >One of our staff is whineing about having to specify the size of all >dimensions for a multidimensional array (beyond the first that is). > >Can anyone give me some good reasons why this is, so I can placate him. >He claims that it can be done in C so why can't it be done in C++. I don't believe that C and C+ are different here. Consider the following: int foobar (int arg1[][5], int (*arg2)[5]); It ain't obvious, but both arguments have exactly the same type (in both C and in C++). That's because of an obscure rule that says that if the type of a parameter is an array type, that type gets implicitly converted to a pointer type. Now if your collegue is grumbling about C vs. C++, tell him to try this on his favorite C compiler: int foobar (p) int (*iap)[]; { p++; } When he comes back to you and says that the increment statement was flagged with an error, then you can both have fun trying to understand why. -- // Ron Guilmette // C++ Entomologist // Internet: rfg@ncd.com uucp: ...uunet!lupine!rfg // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.