|
A .45 because they don't make a .46.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
In that case I can blindfold him me think...
I have a M4A1 and a Glock 37...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Ah, the functional programming approach...
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Presumably you get to say which crate you pick from, even though you can't see it?
In which case, assuming you trust the person leading you to the crate, you pick from "Mix", reminisce about the good old days of Woolworths "Pic'n'mix" for a while, and then the solution is trivial.
(Whatever you pick is the real contents of the "Mix" crate; the crate with that fruit on its label is the other fruit; and the crate with the other fruit on its label is the "Mix" crate.)
If you can't see which crate you're picking from, then you'll have to resort to JSOP's answer.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
You pick from the mix box as that must be either apples or oranges. After that the other two are obvious.
veni bibi saltavi
|
|
|
|
|
One is really heavy, the other is a little lighter.
I'll get me coat.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
:groan:
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
We're gonna get you, hippozippo.
|
|
|
|
|
Ron Anders wrote: We're gonna get you, hippozippoGriffo.
FTFY
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
X & Y is not the same as
X && Y
Twenty minutes wasted on a condition who refused to yield the correct result.
CALL APOGEE, SAY AARDWOLF
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
"Go ahead, make my day"
|
|
|
|
|
Programming Lesson of the Day #2: If you'd used C# it wouldn't have compiled ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Programming Lesson of the Day #3: Check your assumptions before posting them as a lesson!
bool x = true;
bool y = false;
(x & y).Dump();
It's not commonly used, but for booleans, & is the non-short-circuiting version of && . It's the C# equivalent of VB.NET's And , whereas && equates to AndAlso .
Binary & operators are predefined for the integral types and bool. ... For bool operands, & computes the logical AND of its operands; that is, the result is true if and only if both its operands are true.
The & operator evaluates both operators regardless of the first one's value.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
And I've learned something today!
Thank you - I didn't know that.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
Why limit it to today?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Because we don't want him to stop posting his thoughts of the day... we need this... our precious.
Jeremy Falcon
|
|
|
|
|
Just to expand on Richard's point...
I'm more of a C guy than C#, but like with C/C++ I can only assume that in this case, the compiler is doing a binary operation of AND, and 1 (or any non-zero) AND 0 is always going to be zero, which is expressed as false in this case. It's the difference between a bitwise operator and a logical one.
Jeremy Falcon
|
|
|
|
|
That's why C# didn't adopt the C convention that any non-zero value is true: you can't treat an integer as a boolean directly.
Hence why I assumed that the compiler would complain, it does with
if (myInt = 6)
... because an integer isn't a boolean value
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Oh I hear ya man. I reckon the difference being the compiler knows that's an assignment operator. My understanding of the way C# and Java does things is to create an object where needed from literals / constants / expressions. So, it would be more like this...
"Hello, world!".ToUpper()
...just instead of a string it's a false... which gets treated like a boolean.
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: I reckon the difference being the compiler knows that's an assignment operator.
Nope, it's because both C# and Java are more type safe (strong typed) than C is. In this case they define a boolean type, C just interprets an integer to have similar "meaning" to a boolean. And the if statement (in C#/Java) requires a boolean input argument. It's the same sort of situation as sending a string into a function which expected a float - compiler error - wrong type.
This is an example of where C uses a weak typing system. It generally just uses the raw data as if it's in the expected type. Effectively turning it into a raw type-cast. The more strongly typed languages disallow most of these, probably because they tend to be the reason behind lots of bugs (if not most).
|
|
|
|
|
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
At the same time C# is too rigid, especially with data which may have to be taken as raw (like a read from another process' memory) and read differently depending on other circumstances. I had to develop a C# plugin for VS that allowed me to visualize 8 bits or 16 bits grayscale images taken from the memory of a debugged process, either completely raw with parameters (height, width, bitsperpixel) inserted manually or taken from a standard structure we use in our codebase, which was stored in memory. Doing the necessary casts was freaking tough and required craptons of code and workarounds, while with C it would have been immediate.
I prefer the need of more attention of C towards the need of knowing a stupid framework as with .NET languages - a poorly documented framework BTW since while every method and object is documented there isn't single piece of documentation explaining WEHN to use a particular namespace/object instead of a similarly named one, which are the related structures/objects/methods... compare that to Win32 APIs documentation.
CALL APOGEE, SAY AARDWOLF
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
"Go ahead, make my day"
|
|
|
|
|
I find the strong typing of C# is more of a help than a hindrance.
Back in my C days I would get into horrible tangles doing precisely what you are trying to do.
An int is not a bool even though many programmers of the era would treat them alike. I still encounter data tables that have integers or even strings used as boolean values and it makes my skin crawl.
We're philosophical about power outages here. A.C. come, A.C. go.
|
|
|
|
|
Remember that C was designed to replace assembly. Common assembly directives are things like "Branch if equal to 0", "Branch if not equal to 0", etc.
No Booleans in assembly.
In C, a string "abc" is really just the address of the letter 'a' in memory.
So it is not really a "boolean",
You are just asking the compiler is the address NULL (0) or not.
char * str1 = "abc";
char * str2 = NULL; // #define NULL 0
if (str1) { /* will execute / }
if (str2) { / will NOT execute */ }
|
|
|
|