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


Groups > comp.lang.c > #26113

Re: How to name a function to indicate that they require calling from a critical section?

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: How to name a function to indicate that they require calling from a critical section?
Date 2012-09-08 13:56 +1200
Message-ID <aavmtqFok6U5@mid.individual.net> (permalink)
References <12497759-f557-4c9a-a4f4-7bcf177b251d@googlegroups.com> <GhVUr.1067102$3s1.72445@fx12.am4> <lnr4rfvl3q.fsf@nuthaus.mib.org> <kfnk3w5kfne.fsf@x-alumni2.alumni.caltech.edu> <k2dnbm$rab$1@dont-email.me>

Show all headers | View raw


On 09/ 8/12 09:01 AM, Stephen Sprunk wrote:
> On 07-Sep-12 10:37, Tim Rentsch wrote:
>> Keith Thompson<kst-u@mib.org>  writes:
>>> (The kernel is arguably part of the implementation, and even if it
>>> isn't, it's probably ok for the developers to rely on certain
>>> behaviors that aren't defined by the language standard.)
>>
>> The Linux kernel is part of no existing C implementation.
>
> The _running_ kernel is arguably part of the implementation; the kernel
> _source being compiled_ is not.
>
>> And, even if it were, it is not part of implementations running on other
>> operating systems (eg MS windows or MacOS), yet presumably it's expected
>> to be compileable some such environments, so it's still breaking the
>> rules regarding reserved identifiers.
>
> The Linux kernel is only expected to be compilable by GCC, and successfully
> compiling the Linux kernel is a gate in the GCC release process, so the two
> are intimately tied together.
>
> I would expect the same of Windows and MSVC, etc.  Kernels are special.

Not necessarily. One of the early tasks when the Solaris kernel was 
open-sourced was to get it to compile cleanly with gcc as well as the 
native compiler.  This took a while, but in the process removed a lot of 
cruft from the source.  Just like any other code base, being able to 
compile with more than one compiler is a good way to improve and 
maintain code quality.  From my occasional exposure to it, my impression 
is the Linux kernel is a lost cause when it comes to compiler portability!

Due to their size and reliance on high levels of optimisation, kernels 
are more susceptible than most applications to compiler bugs.  This 
should be seen as an opportunity to improve compiler quality rather than 
a direct coupling.

>> Don't get me wrong, it's no big deal that these particular rules are
>> being broken in this case, but that doesn't mean the rules aren't being
>> broken.
>
> In such a case, the normal rules are simply not relevant.
>
> OTOH, that also means that one should always be careful before using kernel
> source as an example of how to write non-kernel source.

See above.

-- 
Ian Collins

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


Thread

How to name a function to indicate that they require calling from a critical section? celephicus@gmail.com - 2012-08-08 18:55 -0700
  Re: How to name a function to indicate that they require calling from a critical section? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-09 08:31 -0400
  Re: How to name a function to indicate that they require calling from a critical section? "China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> - 2012-08-09 12:24 -0700
    Re: How to name a function to indicate that they require calling from a critical section? Keith Thompson <kst-u@mib.org> - 2012-08-09 13:59 -0700
  Re: How to name a function to indicate that they require calling from a critical section? Andrew Cooper <amc96@cam.ac.uk> - 2012-08-09 21:43 +0100
    Re: How to name a function to indicate that they require calling from a critical section? Keith Thompson <kst-u@mib.org> - 2012-08-09 13:58 -0700
      Re: How to name a function to indicate that they require calling from a critical section? Andrew Cooper <amc96@cam.ac.uk> - 2012-08-09 23:11 +0100
        Re: How to name a function to indicate that they require calling from a critical section? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-09 18:22 -0400
      Re: How to name a function to indicate that they require calling from a critical section? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 08:37 -0700
        Re: How to name a function to indicate that they require calling from a critical section? Stephen Sprunk <stephen@sprunk.org> - 2012-09-07 16:01 -0500
          Re: How to name a function to indicate that they require calling from a critical section? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 18:37 -0700
            Re: How to name a function to indicate that they require calling from a critical section? Stephen Sprunk <stephen@sprunk.org> - 2012-09-30 00:17 -0500
              Re: How to name a function to indicate that they require calling from a critical section? Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-17 14:24 -0800
          Re: How to name a function to indicate that they require calling   from a critical section? Ian Collins <ian-news@hotmail.com> - 2012-09-08 13:56 +1200
            Re: How to name a function to indicate that they require calling   from a critical section? Stephen Sprunk <stephen@sprunk.org> - 2012-09-30 13:45 -0500

csiph-web