double is_computer_on_fire( void )
BeOS kernel function, returns the temperature of the motherboard if the computer is currently on fire. Smoldering doesn't count. If the computer isn't on fire, the function returns some other value. (Be Book)


see also: is_computer_on()


to be consistent with the naming conventions used in the rest of the BeOS API, 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.
This definitely lowers my opinion of BeOS. The coding style used is terrible! You should never name your predicates is_something. A predicate is not asking a question, it is answering it. Consider this code fragment:
if (is_computer_on_fire()) {
  dump_halon(computer_room);
}

You cannot read it out loud, because it doesn't sound like English.

Much better alternatives would be computer_is_on_fire(), computer_on_fire() or the Lisp-like computer_on_fire_p() (using the -P convention). All of these let you read your code.

Actually, ariels, I'd say your suggestions are just as flawed. The big problem I see with this function, is that it looks, by its name, to be returning a boolean value, where it actually returns a double. I say it would more properly be named something along the lines of getFlamingMotherboardTemperature, or something like that.

Of course, I was greatly amused by this, and is_computer_on(), and immediately included them in the function library I'm currently using in a production system, to replace the random number generators.

Log in or registerto write something here or to contact authors.