Topic: pointers to members of a class
Author: nukalasr@my-deja.com
Date: 1999/08/07 Raw View
I tried to create a static array of pointers to members of a class
in the constructor of that class, and initialized the array with
pointers to members of the class. Compiler complained about malloc
when size of that array is 32800.
Is there a limit to the no. of pointers to members of a class.
Any help is appreciated.
Thanx
sreenivas nukala
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Francis Glassborow <francis@robinton.demon.co.uk>
Date: 1999/08/07 Raw View
In article <7ofir9$qmr$1@nnrp1.deja.com>, nukalasr@my-deja.com writes
> I tried to create a static array of pointers to members of a class
>in the constructor of that class, and initialized the array with
>pointers to members of the class. Compiler complained about malloc
>when size of that array is 32800.
what are you playing around with malloc for? Why are you requiring more
than 2^15 pointers to member? I guess you just blew the limit on the
default size for static storage on your compiler.
>
> Is there a limit to the no. of pointers to members of a class.
>Any help is appreciated.
Probably, but any class that had that number of members would definitely
be unusable, even if mechanically generated.
Why not make your static a list so that it would be as long as
necessary, or a vector which could grow if extra members were added etc.
IOWs try a half-way reasonable design rather than massive over-
specification.
Francis Glassborow Journal Editor, Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]