Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #68519

Re: sht static guard locks

From jacobnavia <jacob@jacob.remcomp.fr>
Newsgroups comp.lang.c
Subject Re: sht static guard locks
Date 2015-08-27 23:15 +0200
Organization A noiseless patient Spider
Message-ID <mrnuig$8rv$1@dont-email.me> (permalink)
References <3c9716ac-61bd-4d69-bdcd-3635ea54bf73@googlegroups.com>

Show all headers | View raw


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.

> 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.

> 3) how to avoid it in most easy way?

Call the C compiler and not the C++ compiler for performance critical 
code. Or switch entirely to C. You are writing it mostly in assembler 
anyway, I do not understand why do you use C++!!

> 4) how to be sure my app do not contains such sh*t?
>

By using the C compiler instead of the C++ compiler

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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