267 lines
13 KiB
Markdown
267 lines
13 KiB
Markdown
---
|
||
created_at: '2014-12-21T19:25:17.000Z'
|
||
title: Is_computer_on_fire() (2000)
|
||
url: http://everything2.com/title/is_computer_on_fire%2528%2529
|
||
author: adamnemecek
|
||
points: 117
|
||
story_text: ''
|
||
comment_text:
|
||
num_comments: 56
|
||
story_id:
|
||
story_title:
|
||
story_url:
|
||
parent_id:
|
||
created_at_i: 1419189917
|
||
_tags:
|
||
- story
|
||
- author_adamnemecek
|
||
- story_8780606
|
||
objectID: '8780606'
|
||
|
||
---
|
||
[Source](https://everything2.com/title/is_computer_on_fire() "Permalink to is_computer_on_fire() - Everything2.com")
|
||
|
||
# is_computer_on_fire() - Everything2.com
|
||
|
||
__
|
||
|
||
Near Matches Ignore Exact
|
||
|
||
[Everything2][1]
|
||
|
||
# is_computer_on_fire()
|
||
|
||
| ----- |
|
||
| ([thing][2]) | by [**beek][3]** | Fri Aug 18 2000 at 16:51:09 |
|
||
|
||
`double **is_computer_on_fire(** void **)**`
|
||
: [BeOS][4] [kernel][5] function, returns the [temperature][6] of the [motherboard][7] if the [computer][8] is currently on fire. [Smoldering][9] doesn't count. If the computer isn't on fire, the function returns some other value. _([Be Book][10])_
|
||
|
||
|
||
|
||
_see also:_ [is_computer_on()][11]
|
||
|
||
* * *
|
||
|
||
|
||
to be [consistent][12] with the [naming][13] [convention][14]s used in the rest of the [BeOS][4] [API][15], this function should really be
|
||
|
||
|
||
static bool BComputer::isOnFire();
|
||
|
||
and should return false if the computer _is not_ on fire. I guess it's okay to return an undefined value when the computer _is_ on fire.
|
||
|
||
| -----|
|
||
|
|
||
|
||
| [I like it!][16] | [1 **C!**][17] |
|
||
|
||
| ----- |
|
||
| ([idea][18]) | by [**ariels][19]** | Thu Sep 14 2000 at 11:34:11 |
|
||
|
||
This definitely lowers my opinion of [BeOS][4]. The [coding style][20] used is [terrible][21]! You should _never_ name your [predicate][22]s `is_`_something_. A predicate is not [_ask][23]ing_ a [question][24], it is [_answer][25]ing_ it. Consider this [code fragment][26]:
|
||
|
||
>
|
||
>
|
||
> if (is_computer_on_fire()) {
|
||
> dump_halon(computer_room);
|
||
> }
|
||
>
|
||
|
||
You cannot read it [out loud][27], because it doesn't sound like [English][28].
|
||
|
||
Much better alternatives would be [`computer][8]_is_on[_fire][29]()`, `computer_on_fire()` or the [Lisp][30]-like `computer_on_fire_p()` (using [the -P convention][31]). All of these let you read your code.
|
||
|
||
| -----|
|
||
|
|
||
|
||
| [I like it!][32] | |
|
||
|
||
| ----- |
|
||
| ([idea][33]) | by [**SlightlyMadman][34]** | Thu Sep 14 2000 at 13:34:22 |
|
||
|
||
Actually, [ariels][35], I'd say your suggestions are just as [flawed][36]. The big problem I see with this [function][37], is that it looks, by its name, to be returning a [boolean][38] value, where it actually returns a [double][39]. I say it would more properly be named something along the lines of [getFlamingMotherboardTemperature][40], or something like that.
|
||
|
||
Of course, I was greatly amused by this, and [is_computer_on()][11], and immediately included them in the function [library][41] I'm currently using in a production system, to replace the [random number generators][42].
|
||
|
||
| -----|
|
||
|
|
||
|
||
| [I like it!][43] | [1 **C!**][44] |
|
||
|
||
| ----- |
|
||
| [is_computer_on()][45] | [The -P convention][46] | [lpt on fire][47] | [New UNIX filesystem permissions based on Everything2 behavior][48] |
|
||
| [Be Book][49] | [BeOS][50] | [Products that shoot flames][51] | [Response.IsClientConnected][52] |
|
||
| [Smoldering][53] | [Homeward Bound: The Incredible Journey][54] | [Predicate][55] | [Basic][56] |
|
||
| [Fire][57] | [Geeks][58] | [halon][59] | [double][60] |
|
||
| [Splinter][61] | [temperature][62] | [strfry][63] | [LISP][64] |
|
||
| [computer][65] | | | |
|
||
|
||
[Log in][66] or [register][67] to write something here or to contact authors.
|
||
|
||
## Sign in
|
||
|
||
| ----- |
|
||
| **Login** | |
|
||
| **Password** | |
|
||
|
||
remember me
|
||
[Lost password][68]
|
||
|
||
[**Sign up][69]**
|
||
|
||
Need help? [accounthelp@everything2.com][70]
|
||
|
||
## Recommended Reading
|
||
|
||
#### [About Everything2][71]
|
||
|
||
#### [User Picks][72]
|
||
|
||
* [So, You Bought a Child Sex Doll.][73]
|
||
* [Saxophone][74]
|
||
* [Honeybee Language and Wittgenstein][75]
|
||
* [Ludwig van Beethoven][76]
|
||
* [Tempo in chess][77]
|
||
* [Etan Patz][78]
|
||
|
||
#### [Editor Picks][79]
|
||
|
||
* [Thermopylae][80]
|
||
* [Don't Leave Before the Miracle][81]
|
||
* [George W. Bush's address to the UN General Assembly: September 12, 2002][82]
|
||
* [Why eat imitation food?][83]
|
||
* [closed captioning][84]
|
||
* [Spontaneous human combustion][85]
|
||
|
||
## New Writeups
|
||
|
||
* [Justin Trudeau's Whacky Indian Adventure][86] ([person][87]) by [TheAnglican][88]
|
||
* [transposing instrument][89] ([thing][90]) by [TheAnglican][88]
|
||
* [icky][91] ([fiction][92]) by [lostcauser][93]
|
||
* [It has been claimed that some or all of this article or section is incoherent and not understandable, and should possibly be reworded if the intended meaning can be determined][94] ([log][95]) by [gate][96]
|
||
* [I'm going to have to ask you to leave][97] ([thing][98]) by [Bethaven][99]
|
||
* [Saxophone][100] ([thing][74]) by [TheAnglican][88]
|
||
* [Office Romance][101] ([poetry][102]) by [syntaxfree][103]
|
||
* [February 22, 2018][104] ([log][105]) by [Stasik][106]
|
||
* [zoot][107] ([person][108]) by [TheAnglican][88]
|
||
* [The Muppet Show][109] ([review][110]) by [TheAnglican][88]
|
||
|
||
([more][111])
|
||
|
||
Everything2 ™ is brought to you by Everything2 Media, LLC. All content copyright © original author unless stated otherwise.
|
||
_Let sleeping demons lie._
|
||
|
||
[1]: https://everything2.com/
|
||
[2]: https://everything2.com/user/beek/writeups/is_computer_on_fire%2528%2529
|
||
[3]: https://everything2.com/user/beek
|
||
[4]: https://everything2.com/title/BeOS "BeOS"
|
||
[5]: https://everything2.com/title/kernel "kernel"
|
||
[6]: https://everything2.com/title/temperature "temperature"
|
||
[7]: https://everything2.com/title/motherboard "motherboard"
|
||
[8]: https://everything2.com/title/computer "computer"
|
||
[9]: https://everything2.com/title/Smoldering "Smoldering"
|
||
[10]: https://everything2.com/title/Be+Book "Be Book"
|
||
[11]: https://everything2.com/title/is_computer_on%2528%2529 "is_computer_on()"
|
||
[12]: https://everything2.com/title/consistent "consistent"
|
||
[13]: https://everything2.com/title/naming "naming"
|
||
[14]: https://everything2.com/title/convention "convention"
|
||
[15]: https://everything2.com/title/API "API"
|
||
[16]: https://everything2.com/title/is_computer_on_fire%2528%2529?like_id=710134&confirmop=ilikeit "send a message to the author telling them someone likes their work"
|
||
[17]: https://everything2.com/title/is_computer_on_fire%2528%2529?showwidget=showCs710134 "1 users found this writeup COOL"
|
||
[18]: https://everything2.com/user/ariels/writeups/is_computer_on_fire%2528%2529
|
||
[19]: https://everything2.com/user/ariels
|
||
[20]: https://everything2.com/title/coding+style "coding style"
|
||
[21]: https://everything2.com/title/terrible "terrible"
|
||
[22]: https://everything2.com/title/predicate "predicate"
|
||
[23]: https://everything2.com/title/ask "ask"
|
||
[24]: https://everything2.com/title/question "question"
|
||
[25]: https://everything2.com/title/answer "answer"
|
||
[26]: https://everything2.com/title/code+fragment "code fragment"
|
||
[27]: https://everything2.com/title/out+loud "out loud"
|
||
[28]: https://everything2.com/title/English "English"
|
||
[29]: https://everything2.com/title/fire "fire"
|
||
[30]: https://everything2.com/title/Lisp "Lisp"
|
||
[31]: https://everything2.com/title/the+-P+convention "the -P convention"
|
||
[32]: https://everything2.com/title/is_computer_on_fire%2528%2529?like_id=747788&confirmop=ilikeit "send a message to the author telling them someone likes their work"
|
||
[33]: https://everything2.com/user/SlightlyMadman/writeups/is_computer_on_fire%2528%2529
|
||
[34]: https://everything2.com/user/SlightlyMadman
|
||
[35]: https://everything2.com/title/ariels "ariels"
|
||
[36]: https://everything2.com/title/flawed "flawed"
|
||
[37]: https://everything2.com/title/function "function"
|
||
[38]: https://everything2.com/title/boolean "boolean"
|
||
[39]: https://everything2.com/title/double "double"
|
||
[40]: https://everything2.com/title/getFlamingMotherboardTemperature "getFlamingMotherboardTemperature"
|
||
[41]: https://everything2.com/title/library "library"
|
||
[42]: https://everything2.com/title/random+number+generators "random number generators"
|
||
[43]: https://everything2.com/title/is_computer_on_fire%2528%2529?like_id=747878&confirmop=ilikeit "send a message to the author telling them someone likes their work"
|
||
[44]: https://everything2.com/title/is_computer_on_fire%2528%2529?showwidget=showCs747878 "1 users found this writeup COOL"
|
||
[45]: https://everything2.com/title/is_computer_on%2528%2529
|
||
[46]: https://everything2.com/title/The+-P+convention
|
||
[47]: https://everything2.com/title/lpt+on+fire
|
||
[48]: https://everything2.com/title/New+UNIX+filesystem+permissions+based+on+Everything2+behavior
|
||
[49]: https://everything2.com/title/Be+Book
|
||
[50]: https://everything2.com/title/BeOS
|
||
[51]: https://everything2.com/title/Products+that+shoot+flames
|
||
[52]: https://everything2.com/title/Response.IsClientConnected
|
||
[53]: https://everything2.com/title/Smoldering
|
||
[54]: https://everything2.com/title/Homeward+Bound%253A+The+Incredible+Journey
|
||
[55]: https://everything2.com/title/Predicate
|
||
[56]: https://everything2.com/title/Basic
|
||
[57]: https://everything2.com/title/Fire
|
||
[58]: https://everything2.com/title/Geeks
|
||
[59]: https://everything2.com/title/halon
|
||
[60]: https://everything2.com/title/double
|
||
[61]: https://everything2.com/title/Splinter
|
||
[62]: https://everything2.com/title/temperature
|
||
[63]: https://everything2.com/title/strfry
|
||
[64]: https://everything2.com/title/LISP
|
||
[65]: https://everything2.com/title/computer
|
||
[66]: https://everything2.com/node/superdoc/login "login"
|
||
[67]: https://everything2.com/node/superdoc/Sign+Up "Sign Up"
|
||
[68]: https://everything2.com/node/superdoc/Reset+password "Reset password"
|
||
[69]: https://everything2.com/node/superdoc/Sign+up
|
||
[70]: mailto:accounthelp%40everything2.com
|
||
[71]: https://everything2.com/title/An+Introduction+to+Everything2
|
||
[72]: https://everything2.com/node/superdoc/Cool+Archive
|
||
[73]: https://everything2.com/user/CultureAndOrCrisis/writeups/So%252C+You+Bought+a+Child+Sex+Doll.
|
||
[74]: https://everything2.com/user/TheAnglican/writeups/Saxophone
|
||
[75]: https://everything2.com/user/CultureAndOrCrisis/writeups/Honeybee+Language+and+Wittgenstein
|
||
[76]: https://everything2.com/user/benny+moonshine/writeups/Ludwig+van+Beethoven
|
||
[77]: https://everything2.com/user/gitm/writeups/Tempo+in+chess
|
||
[78]: https://everything2.com/user/Serjeant%2527s+Muse/writeups/Etan+Patz
|
||
[79]: https://everything2.com/node/superdoc/Page+of+Cool
|
||
[80]: https://everything2.com/title/Thermopylae
|
||
[81]: https://everything2.com/title/Don%2527t+Leave+Before+the+Miracle
|
||
[82]: https://everything2.com/title/George+W.+Bush%2527s+address+to+the+UN+General+Assembly%253A+September+12%252C+2002
|
||
[83]: https://everything2.com/title/Why+eat+imitation+food%253F
|
||
[84]: https://everything2.com/title/closed+captioning
|
||
[85]: https://everything2.com/title/Spontaneous+human+combustion
|
||
[86]: https://everything2.com/title/Justin+Trudeau%2527s+Whacky+Indian+Adventure?author_id=2101931#TheAnglican
|
||
[87]: https://everything2.com/user/TheAnglican/writeups/Justin+Trudeau%2527s+Whacky+Indian+Adventure
|
||
[88]: https://everything2.com/user/TheAnglican
|
||
[89]: https://everything2.com/title/transposing+instrument?author_id=2101931#TheAnglican
|
||
[90]: https://everything2.com/user/TheAnglican/writeups/transposing+instrument
|
||
[91]: https://everything2.com/title/icky?author_id=1992599#lostcauser
|
||
[92]: https://everything2.com/user/lostcauser/writeups/icky
|
||
[93]: https://everything2.com/user/lostcauser
|
||
[94]: https://everything2.com/title/It+has+been+claimed+that+some+or+all+of+this+article+or+section+is+incoherent+and+not+understandable%252C+and+should+possibly+be+reworded+if+the+intended+meaning+can+be+determined?author_id=1252419#gate
|
||
[95]: https://everything2.com/user/gate/writeups/It+has+been+claimed+that+some+or+all+of+this+article+or+section+is+incoherent+and+not+understandable%252C+and+should+possibly+be+reworded+if+the+intended+meaning+can+be+determined
|
||
[96]: https://everything2.com/user/gate
|
||
[97]: https://everything2.com/title/I%2527m+going+to+have+to+ask+you+to+leave?author_id=2155861#Bethaven
|
||
[98]: https://everything2.com/user/Bethaven/writeups/I%2527m+going+to+have+to+ask+you+to+leave
|
||
[99]: https://everything2.com/user/Bethaven
|
||
[100]: https://everything2.com/title/Saxophone?author_id=2101931#TheAnglican
|
||
[101]: https://everything2.com/title/Office+Romance?author_id=1957383#syntaxfree
|
||
[102]: https://everything2.com/user/syntaxfree/writeups/Office+Romance
|
||
[103]: https://everything2.com/user/syntaxfree
|
||
[104]: https://everything2.com/title/February+22%252C+2018?author_id=2155469#Stasik
|
||
[105]: https://everything2.com/user/Stasik/writeups/February+22%252C+2018
|
||
[106]: https://everything2.com/user/Stasik
|
||
[107]: https://everything2.com/title/zoot?author_id=2101931#TheAnglican
|
||
[108]: https://everything2.com/user/TheAnglican/writeups/zoot
|
||
[109]: https://everything2.com/title/The+Muppet+Show?author_id=2101931#TheAnglican
|
||
[110]: https://everything2.com/user/TheAnglican/writeups/The+Muppet+Show
|
||
[111]: https://everything2.com/node/superdoc/Writeups+by+Type
|
||
|