Can Singleton be abstracted?

Started by
21 comments, last by WebsiteWill 20 years, 5 months ago
quote:Original post by msn12b
Singleton is a hack. It causes the exact same problem it tries to solve.


The implementation is particularily problematic in C++. In other environments, it''s not so hairy.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
quote:Original post by Magmai Kai Holmlor

quote:
Loki::SingletonHolder does provide a semi-thread safe policy, though it does have defects.

How so?



Its explained in the book, chapter six. The problems come from certain symmetric multiprocessor environments.



quote:Original post by Magmai Kai Holmlor
quote:Original post by msn12b
Singleton is a hack. It causes the exact same problem it tries to solve.


The implementation is particularily problematic in C++. In other environments, it''s not so hairy.

Not like Java, eh....
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/

This topic is closed to new replies.

Advertisement