View Single Post

   
  #8 (permalink)  
Old 02-21-2008, 05:33 AM
Chris Sorenson
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

Loki Harfagr wrote:
> Thu, 16 Aug 2007 17:04:25 +0500, Ayaz Ahmed Khan did cat :
>
>
>>"Yeti" typed:
>>
>>
>>>if isWorking(/dev/breathalizer)
>>>{
>>> bool number = user->blow()
>>>
>>> if (number = 1) {
>>> printf("No root for you!\n")
>>> exit(1);
>>> }
>>>}

>>
>>With that, you will always be found to be drunk (and without root).

>
>
> which from this shown tendency to test variables out of scope
> and use assignments in place of tests is probably
> safer ;-)
>


Plus there's no bool data type in C (C++ yes but that sucks and is
evil!).

Everyone missed the boo-boo in my initial code, number should have been
declared float not int...

> Personally my foolproof test to check if I'd better not
> use 'root' is to try and open a file:
>
> # vi smurf
>
> if I get this output I know I'm well done:-)
>
> smurf,v <-- smurf
> ci: smurf: No such file or directory


That would work for me because I'd never try to use vi unless I
was already quite inebriated!
Reply With Quote