Kevin Atkinson wrote: > > On Wed, 19 Feb 2003, Alexander Terekhov wrote: > > > struct pthread_mutex_t_ { > > > > /* ... */ > > > > #ifdef __cplusplus > > > > __copy_ctor(const pthread_mutex_t_&) { > > throw "Don't do this!"; > > } > > > > #endif > > > > }; > > typedef struct pthread_mutex_t_ pthread_mutex_t; > > I do not know where it is implemented, it is not on my system, this way > but I think what I did should be perfectly legal as I am merely initializing > the class. In fact having ANY constructor will prevent the statement > "pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER" from working on my > system and probably others which IS legal. This is because if you have ANY > contractor defined and PTHREAD_MUTEX_INITIALIZER is a macro which uses the > "{...}" form you will get something like this "...must be initialized by > constructor, not by `{...}'.
Nah. That doesn't apply the "__" constructor(s). ;-) > > I have changed the definition to: > > #ifdef FAST_MUTEX_INIT_DESTROY ^^^^^^^ > static const pthread_mutex_t MUTEX_INIT = PTHREAD_MUTEX_INITIALIZER; Uhmm. What does your "fast destruction" do? Well, looking at the code you've posted, it does nothing... and that's the "fastest" way to leak. > #endif Get rid of it. Really. Here's another "example": struct pthread_mutex_t_ { void* validation_sentinel; /* ... */ }; typedef struct pthread_mutex_t_ pthread_mutex_t; #define PTHREAD_MUTEX_INITIALIZER { &__aggregate /* ... */ } regards, alexander. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost