[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20000802: netcdf 3.5-beta3 installation problem on IBM SP
- Subject: Re: 20000802: netcdf 3.5-beta3 installation problem on IBM SP
- Date: Thu, 03 Aug 2000 09:48:08 -0600
>From: Harsh Anand <address@hidden>
>Subject: netcdf 3.5-beta3 installation problem on IBM SP
>Organization: LBNL/NERSC
>Keywords: 200008022147.e72LljT08254 netCDF 3.5-beta3
Hi Harsh,
> I got errors like
>
> xlC -c -I../libsrc -I. -DNDEBUG netcdf.cpp
> "netcdfcpp.h", line 156.10: 1540-0133 (S) The attributes "friend" are
> not allowed.
>
> installing C++ interface on the IBM SP3 we have at NERSC Lawrence
> Berkeley Lab:
>
> FYI -- IBM tech support folks tell me that it is not a bug. According
> to the
> standard "The attributes "friend" are not allowed". Could you
> please suggest any workaround for this problem?
> I have successfully compiled this program using KAI C++ compiler.
See a previous message for a workaround:
http://www.unidata.ucar.edu/glimpse/netcdf/3814
But I don't understand how this could be non-standard C++. The draft
standard available from
http://www.cygnus.com/misc/wp/dec96pub/access.html includes the
following example:
4 When a friend declaration refers to an overloaded name or operator,
only the function specified by the parameter types becomes a friend.
A member function of a class X can be a friend of a class Y. [Exam-
ple:
class Y {
friend char* X::foo(int);
// ...
};
which uses the same syntax we use. Is it that you can't declare a
private constructor to be a friend? If so, I haven't seen that
restriction explicitly stated anywhere. Can you find out where in the
standard this syntax is disallowed, since no other C++ compiler we
have tried objects to it?
A less heavy-handed workaround would be to declare the whole NcFile
class to be a friend rather than just particular member functions,
that is use
friend NcFile;
instead of
friend NcFile::NcFile( const char *, FileMode, size_t*, size_t);
friend NcBool NcFile::sync( void );
friend NcDim* NcFile::add_dim( NcToken, long );
// to delete dimensions, since destructor is private
friend NcBool NcFile::close( void );
and similarly for other places where the compiler objects to the
declarations of particular member functions as friends. But I don't
understand why this should be necessary ...
--Russ