Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: sht static guard locks |
| Date | 2015-08-28 11:02 +1200 |
| Message-ID | <d49j8iFrgntU12@mid.individual.net> (permalink) |
| References | <3c9716ac-61bd-4d69-bdcd-3635ea54bf73@googlegroups.com> <mrnuig$8rv$1@dont-email.me> |
jacobnavia wrote: > Le 27/08/2015 20:11, fir a écrit : >> Im not sure if this is a problem of c++ >> only or it appleies to c, too >> >> Sometimes (usually?) when using static entities >> in functions the compiler puts special code which >> contains a lock acquire and release >> > > This is because C++ changed yet again the language underneath your feet. > >> Thisd bloats the executable yet also slows down the code.. Im not quite sure >> 1)how serious this problem is? > > If you do not care about performance (as many C++ people do) it doesn't > matter. If you are very interested in performance this is a serious problem. If you take the trouble to look (but that would spoil a good rant, wouldn't it?) you would see that static variable initialisation that is legal in C (from a constant) is treated the same in C++ as C. The compiler inserts guards where a race condition could occur. >> 2) in which cases it do apply? > > in ALL cases where you have the bad idea to compile your code as C++ > instead of compiling it as C, where you wouldn't have any of those problems. If it is seeing guards, the code couldn't be compiled as C. -- Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-27 11:11 -0700
Re: sht static guard locks jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-27 23:15 +0200
Re: sht static guard locks Ian Collins <ian-news@hotmail.com> - 2015-08-28 09:51 +1200
Re: sht static guard locks Les Cargill <lcargill99@comcast.com> - 2015-08-27 18:06 -0500
Re: sht static guard locks David Brown <david.brown@hesbynett.no> - 2015-08-28 10:14 +0200
Re: sht static guard locks Les Cargill <lcargill99@comcast.com> - 2015-08-28 21:30 -0500
Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 00:46 -0700
Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 01:39 -0700
Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 03:09 -0700
Re: sht static guard locks David Brown <david.brown@hesbynett.no> - 2015-08-29 12:43 +0200
Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 03:20 -0700
Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 04:28 -0700
Re: sht static guard locks David Brown <david.brown@hesbynett.no> - 2015-08-29 12:38 +0200
Re: sht static guard locks Ian Collins <ian-news@hotmail.com> - 2015-08-28 11:02 +1200
Re: sht static guard locks Gareth Owen <gwowen@gmail.com> - 2015-08-31 18:15 +0100
csiph-web