Article View: comp.std.c++
Article #3975Array function params and const qualifier
From: Adel El-Beik
Date: Wed, 10 Apr 1996 11:18
Date: Wed, 10 Apr 1996 11:18
48 lines
1956 bytes
1956 bytes
I have a question concerning MSVC++ v.4.00 and the April DWP C++.
The following code fails on MSVC++. It doesn't like line labelled 1.
It complains with
C:\array\array.cpp(16) : error C2664: 'func' : cannot convert parameter 1
from 'long [2][2]' to 'const long [][2]' (new behavior; please see help)
Now as far as I can understand from DWP an implicit conversion should
take place on x. i.e. it is const qualified, and so MSVC++ should not
raise an error. MSVC++ accepts line labelled 2, which should be
what MSVC++ converts the funcion argument and parameter to on 1.
Is their something I've missed, i.e. MSVC++ behaviour matches April
DWP ? Or is MSVC++ followed its own standard, Microsoft claim to
be following evolving standard.
Thanks in advance.
Adel.
// CODE START
typedef long bar[2][2];
typedef const long (*const_bar)[2];
void func( const bar param ){}
void main()
{
bar x;
func( x ); // 1
func( (const_bar)x ); // 2
}
// CODE END
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<4ke06a$rp3@mozart.wg.icl.co.uk>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backShow Full Headers
Complete Article Headers
From: Adel El-Beik <A.El-Beik@man0506.wins.icl.co.uk> Message-ID: <4ke06a$rp3@mozart.wg.icl.co.uk> X-Original-Date: 9 Apr 1996 15:36:42 GMT Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 10 Apr 96 11:18:50 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Subject: Array function params and const qualifier Organization: ICL X-Mailer: Mozilla 1.1N (Windows; I; 16bit) X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMWuZIeEDnX0m9pzZAQGdpgF+JUYLXnHvQWNSfdjRjztiDQSmzyB2Y3+F YffEAs2B3d4MM6tBSYyOfJ142kn7ZrHZ =md8j